For this problem, what is known is only the head pointer to the linked list. The explanation which follows the algorithm assumes l and m are known variables specific to the equation m+k=(b-2a)*l. This assumption is to explain why the approach of slow pointer and fast pointer works.
[Interview Question] Cycles in a Linked List
Write a function to detect whether a cycle exists in a singly-linked list. Then write a function to return the length of the first cycle in the list if it exists.
THank you so much for the video. I have spent the whole morning to learn
the question and all I got was totally bullshit. I have came across many
sources explaning the problem but they were very ambiguous. Why they didn't
say up front that the main aim is to find whether the hare and tortise move
in circles. Had they done so my life would have been alot easier
Cool video! The only thing that wasn't intuitive to me is "how do you know
the hare will reach the same node as the tortoise? what if the hare skips
over the tortoise?" (I get it now; it just took me some time to figure out
myself).
Also, what app is that you're using to draw?
Great video. I remember this question from my first year in Software
engineering,
the Lecturer blew our collective mind :)
Detect a loop in a linked list
Code - https://github.com/IDeserve/learn/blob/master/MyLinkedList.java Given a linked list, write a program to return the start of the loop if a loop exists in that list ...
+Rajan Kasodariya , thanks a lot for your kind words! You may also want to check out our website //www.ideserve.co.in which now has close to 150 questions.
this was the best explanation.....you must explain little bit clearly the
logic for m+k , that is F will cover m steps as S when you move them at
same speed
+Anshul katta Thanks for your feedback!We have tried to explain that F will also cover 'm' steps as S starting in this video at time 6:15 and at time 6:35 where we say that we move both S and F forward one step at a time.Also please check out our website at: //www.ideserve.co.inIt has features like algorithm visualizations, learn together and many more coming soon.Please check it out and leave us a comment there!Thanks,-Team IDeserve.
Finding Loop in LinkedList and reversing Linked List - Lec 38
This video will explain you how to find loop in Linked List and also how to reverse a Linked List.
+Tanveer Asif Thanks .. will provide lectures for all the topics. Can you Please share this channel with ur friends?
Interview Exposed - Finding where the Loop Starts in a Cyclic Linked List
Language: Chinese, Mandarin Author: Yonggang Liu This video serves only for the purpose of study reference. Please leave your feedback in case of any ...