Given a single linked list that contains a loop, find the node where the cycle starts. A very famous problem and an extension of detecting the loop. Using a slow pointer and fast pointer, can help to determine the meeting point. This video gives a mathematical proof on how the pointers meet at the start of loop. All along with diagrams and a dry-run of code in JAVA.
Chapters:
00:00 - Intro
01:11 - Problem statement and description
02:11 - Brute Force approach to find the cycle start point
05:16 - Efficient solution to find the cycle start point
08:27 - Mathematical proof of Floyd-Warshall algorithm
14:52 - Dry-run of code
16:55 - Final Thoughts
Actual problem on LeetCode: leetcode.com/problems/linked-...
📚 Links to topics I talk about in the video:
Detect Cycle in Linked List: • Linked List Cycle (Lee...
Linked List Introduction: • Linked List Data Struc...
Linked List Traversals: • Traversing a Linked Li...
Brute Force Method: • Brute Force algorithms...
Time Complexity: • Big O Notation Simplif...
Playlist on Linked Lists: • Linked Lists
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/36pU0JO
Favorite book to understand algorithms: amzn.to/39w3YLS
Favorite book for data structures: amzn.to/3oAVBTk
Get started for interview preparation: amzn.to/39ysbkJ
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3pAqh8O
Microphone: amzn.to/2MCX7qU
Recording Camera: amzn.to/3alg9Ky
Tablet to sketch and draw: amzn.to/3pM6Bi4
Surface Pen: amzn.to/3pv6tTs
Laptop to edit videos: amzn.to/2LYpMqn
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Follow on Twitter at: / studyalgorithms
Follow on Tumblr at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #linkedlists
4 июл 2024