Why Floyd's Cycle Detection Algorithm Works | Cycle detection in Linked List

  Рет қаралды 34,829

Knowledge Center

Knowledge Center

5 жыл бұрын

Explanation of the Floyd's Loop Detection Algorithm in a Linked List having cycle.
Watch my Courses for Free on Skilshare:
C++11 Move Semantics & rvalue reference: skl.sh/2Jpff2o
C++ Smart Pointers: skl.sh/2JqIlym
Type casting in C++: skl.sh/2G2wh5h
C++ Pointers: skl.sh/2LHW6eB
Discrete Maths: skl.sh/2G3Xbtw
Reinforcement Learning: skl.sh/2XQxEhx
***** Books For Data Structures & Algorithms for Interviews:**********
1. Cracking the Coding Interview: amzn.to/2WeO3eO
2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
**************************************************************************
Support me on Patreon: / knowledgecenter
#Floyd's #Algorithm #Loop

Пікірлер: 72
@theawless
@theawless 3 жыл бұрын
Amazing! This is the most complete proof of the algorithm I've seen. I was tired looking at wikipedia and stack-overflow. Some people made the assumption that hare will make only one loop before reaching the meeting point, but no one explained why. It seems that's the wrong logic. In your proof you mentioned that hare and tortoise can both make some number of loops.
@itsmeac101
@itsmeac101 Жыл бұрын
even after two years. this remains the best proof i could find. thank you!
@shivam7304
@shivam7304 Жыл бұрын
bro the explanation was on point but you need a media player to increase your speed though...
@Its_Sunny-qe8ve
@Its_Sunny-qe8ve
In what case, the slow pointer will complete at least 1 loop because I am getting that in every case , fast pointer will catch slow one before the loop 1 complete. Can anyone provide example in which slow pointer completing at least 1 complete circle of loop
@lambar0
@lambar0 Жыл бұрын
Nice explanation
@crisag.2698
@crisag.2698 4 жыл бұрын
What I'm confused about is how the fast pointer could make more than 2 cycles around the loop before it meets the slow pointer. Intuitively, in my minds eye I see the fast pointer moving at 2x the speed, so I would think that the overlap would happen somewhere before the fast pointer begins its third cycle.
@kamaninikhil71
@kamaninikhil71 2 жыл бұрын
I didnt get why we ignored numbers of loops as constant
@svalyavasvalyava9867
@svalyavasvalyava9867 3 жыл бұрын
I'm so grateful for this explanation. Thanks a ton 😌
@kaifk5889
@kaifk5889 4 жыл бұрын
Sir the way you explained the problem was really amazing. Hoping to see more algorithm videos soon.
@bagasadifirdaus9278
@bagasadifirdaus9278 3 жыл бұрын
Sir can you tell me why the slow pointer is guaranteed not to go over the full loop before meeting the fast pointer?
@takitazwarparthib3555
@takitazwarparthib3555 4 жыл бұрын
GREAT EXPLANATION SIR! HELPED ALOT.. SPECIALLY THAT LAST EXPLANATION WAS EXCELLENT
@prabhupuredla8280
@prabhupuredla8280 4 жыл бұрын
the explanation is clean and precise. Thanks for the video
@DeepakKumar-wh7bv
@DeepakKumar-wh7bv 5 жыл бұрын
Thank You Very Much Sir !. This video solved my doubt. Please Keep uploading videos on problems with mathematical base.
@rohanprak
@rohanprak 4 жыл бұрын
thanks a lot for such a great explanation, this could not have been better.
@prakulcool
@prakulcool 4 жыл бұрын
Well explained. Thank You Sir!
@rohith8269
@rohith8269 9 сағат бұрын
Such a great explanation!
@happyhome422
@happyhome422 3 жыл бұрын
Thank you for nice explanation. 🙏upload more videos
@Vibedecoded
@Vibedecoded Жыл бұрын
Best explanation hands down !
@tongl7380
@tongl7380 4 жыл бұрын
nice video! helps me a lot, thank you
@kartikeydixit3743
@kartikeydixit3743 3 жыл бұрын
Very clear explanation . Thankyou so much
Why Floyd's Cycle Detection algorithm works?
19:30
Dinesh Varyani
Рет қаралды 19 М.
Remove Loop from Linked List | Floyd's Algorithm
9:11
Knowledge Center
Рет қаралды 12 М.
Каха и суп
00:39
К-Media
Рет қаралды 4,3 МЛН
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 67 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 59 МЛН
路飞被小孩吓到了#海贼王#路飞
00:41
路飞与唐舞桐
Рет қаралды 67 МЛН
Why Floyd's cycle detection algorithm works? Detecting loop in a linked list.
24:11
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 113 М.
Programming Anime: Floyd's Algorithm Explained
19:44
JomaClass
Рет қаралды 266 М.
L14. Detect a loop or cycle in LinkedList | With proof and Intuition
20:26
The Black Box Method: How to Learn Hard Concepts Quickly
14:09
Colin Galen
Рет қаралды 1,1 МЛН
Detect Loop in Linked List | Linked List Cycle | Floyd's algorithm | C++
20:15
How I Got Good at Coding Interviews
6:29
NeetCode
Рет қаралды 1,6 МЛН
Interview Question: Start of Loop in a Linked List
10:37
Gaurav Sen
Рет қаралды 143 М.
Каха и суп
00:39
К-Media
Рет қаралды 4,3 МЛН