卷別
資料結構
選擇國立中央大學 2026 · 考試 · 第 11 題
考科資料結構
To detect whether a cycle exists in a singly linked list, the most famous Floyd's Cycle Detection Algorithm (the tortoise and the rabbit algorithm) uses two metrics. Assume the distance from the beginning of the linked list to the start of the cycle is , and the length of the cycle is . Assume the rabbit's speed is twice that of the tortoise. When the tortoise and rabbit meet, assume the tortoise has traveled a distance within the cycle. What is the total distance the rabbit has traveled at this point?
- (A)
- (B)
- (C)
- (D)