We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b552941 commit 255dde0Copy full SHA for 255dde0
Java/FloydAlgorithm/README.md
@@ -0,0 +1,34 @@
1
+
2
+# Sample Input:
3
4
+5
5
6
+1 6 3 7 8
7
8
+2
9
10
11
12
+# Sample Output:
13
14
+Loop exists
15
16
17
18
+# Explaination:
19
20
+4--> size of linked list
21
22
+1-->6-->3-->7-->8 =>nodes of linked list
23
24
+2---> node to be checked
25
26
+</br>
27
28
+after creating the loop the detect loop fuction is called and the two pointer slow and fast meets if loop exists .
29
+For better understanding,refer <a href="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190621160855/Detect-loop-in-a-linked-list.png">here:
30
31
32
+# Time complexity:
33
34
+O(n)
0 commit comments