卷別
資料結構
選擇國立中央大學 2026 · 考試 · 第 12 題
考科資料結構
(承上題 Floyd's Cycle Detection Algorithm 的設定: 為表頭到環起點的距離, 為環長。)
If we change the rabbit's speed to "3 steps each time" and the tortoise's speed to "1 step each time", can this algorithm still detect the cycle?
- (A)No, the rabbit might jump over the tortoise to reach NULL.
- (B)Maybe, check if is a multiple of .
- (C)Maybe, check if is a multiple of 2.
- (D)Perhaps, we can check if and 2 are coprime.