Cycle Detection: Difference between revisions

From Algorithm Wiki
Jump to navigation Jump to search
(Created page with "== Problem Description== cycle detection or cycle finding is the algorithmic problem of finding a cycle in a sequence of iterated function values. == Bounds Chart == 350px == Step Chart == 350px == Improvement Table == {| class="wikitable" style="text-align:center;" width="100%" !width="20%" | Complexity Classes !! width="40%" | Algorithm Paper Links !! width="40%" | Lower Bounds Paper Li...")
 
No edit summary
Line 1: Line 1:
== Problem Description==
{{DISPLAYTITLE:Cycle Detection (Cycle Detection)}}
cycle detection or cycle finding is the algorithmic problem of finding a cycle
== Description ==  
in a sequence of iterated function values.


== Bounds Chart ==
Cycle detection or cycle finding is the algorithmic problem of finding a cycle in a sequence of iterated function values.
[[File:Cycle_DetectionBoundsChart.png|350px]]


== Step Chart ==
== Parameters ==  
[[File:Cycle_DetectionStepChart.png|350px]]
 
<pre>t_f: time to perform one evaluation of f
\mu: the starting index of the cycle
\lambda: the period of the cycle
M: number of values stored</pre>
 
== Table of Algorithms ==
 
{| class="wikitable sortable"  style="text-align:center;" width="100%"
 
! Name !! Year !! Time !! Space !! Approximation Factor !! Model !! Reference


== Improvement Table ==
{| class="wikitable" style="text-align:center;" width="100%"
!width="20%" | Complexity Classes !! width="40%" | Algorithm Paper Links !! width="40%" | Lower Bounds Paper Links
|-
| rowspan="1" | Exp/Factorial
|
|
|-
|-
| rowspan="1" | Polynomial > 3
 
|
| [[Sedgewick; Szymanski; and Yao ( Cycle Detection)|Sedgewick; Szymanski; and Yao]] || 1982 || $(\mu + \lambda)({1}+\Theta({1}/sqrt(M)))$ || M || Exact || Deterministic || [https://epubs.siam.org/doi/abs/10.1137/0211030?journalCode=smjcat Time & Space]
|
|-
|-
| rowspan="1" | Cubic
| [[Nivasch ( Cycle Detection)|Nivasch]] || 2004 || $O(\mu + \lambda)$ || $O(logn)$ || Exact || Deterministic || [https://drive.google.com/file/d/16H_lrjeaBJqWvcn07C_w-6VNHldJ-ZZl/view Time] & [https://www.gabrielnivasch.org/fun/cycle-detection Space]
|
|
|-
|-
| rowspan="1" | Quadratic
| [[Floyd's tortoise and hare algorithm ( Cycle Detection)|Floyd's tortoise and hare algorithm]] || 1967 || $O((\lambda + \mu)$ t_f) || $O({1})$ || Exact || Deterministic || [http://pds7.egloos.com/pds/200801/07/29/p636-floyd.pdf Time]
|
|
|-
|-
| rowspan="1" | nlogn
| [[Brent's algorithm ( Cycle Detection)|Brent's algorithm]] || 1973 || $O((\lambda + \mu)$ t_f) || $O({1})$ || Exact || Deterministic || [https://maths-people.anu.edu.au/~brent/pd/rpb005.pdf Time]
|
|
|-
|-
| rowspan="1" | Linear
| [[Gosper's algorithm ( Cycle Detection)|Gosper's algorithm]] || 1978 || $O((\lambda + \mu)$ log(\lambda + \mu) t_f) || \Theta(log(\mu + \lambda)) || Exact || Deterministic || [https://www.inwap.com/pdp10/hbaker/hakmem/flows.html#item132 Time] & [https://en.wikipedia.org/wiki/Cycle_detection#Gosper's_algorithm Space]
|
|
|-
|-
| rowspan="1" | logn
|}
|
 
|
== Time Complexity graph ==
|-|}
 
[[File:Cycle Detection - Time.png|1000px]]
 
== Space Complexity graph ==
 
[[File:Cycle Detection - Space.png|1000px]]
 
== Pareto Decades graph ==
 
[[File:Cycle Detection - Pareto Frontier.png|1000px]]
 
== References/Citation ==
 
https://www.sciencedirect.com/science/article/pii/0304397585900441?via%3Dihub

Revision as of 11:20, 15 February 2023

Description

Cycle detection or cycle finding is the algorithmic problem of finding a cycle in a sequence of iterated function values.

Parameters

t_f: time to perform one evaluation of f
\mu: the starting index of the cycle
\lambda: the period of the cycle
M: number of values stored

Table of Algorithms

Name Year Time Space Approximation Factor Model Reference
Sedgewick; Szymanski; and Yao 1982 $(\mu + \lambda)({1}+\Theta({1}/sqrt(M)))$ M Exact Deterministic Time & Space
Nivasch 2004 $O(\mu + \lambda)$ $O(logn)$ Exact Deterministic Time & Space
Floyd's tortoise and hare algorithm 1967 $O((\lambda + \mu)$ t_f) $O({1})$ Exact Deterministic Time
Brent's algorithm 1973 $O((\lambda + \mu)$ t_f) $O({1})$ Exact Deterministic Time
Gosper's algorithm 1978 $O((\lambda + \mu)$ log(\lambda + \mu) t_f) \Theta(log(\mu + \lambda)) Exact Deterministic Time & Space

Time Complexity graph

Cycle Detection - Time.png

Space Complexity graph

Cycle Detection - Space.png

Pareto Decades graph

Cycle Detection - Pareto Frontier.png

References/Citation

https://www.sciencedirect.com/science/article/pii/0304397585900441?via%3Dihub