In this video, I have explained how to find start node of a cycle in linked list. This is usually asked as a followup of Detect Cycle in Linked List.
Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null.
I have explained 2 methods to solve this:
1. Using hashmap
2. Using Floyd Cycle Detection algorithm (Tortoise-hare algorithm)
I have also given the proof of why the slow and fast pointers will meet in Floyd Cycle Detection algorithm.
Source code: https://github.com/fit-coder/fitcoder...
00:00 Introduction
00:09 Problem explanation
01:18 Method 1 - Using Hashmap
03:30 Method 2 - Floyd Cycle Detection Algorithm
08:35 Proof of Floyd Cycle Detection Algorithm
12:38 Implementation
Detect Cycle in Linked List: • Detect Cycle In Linked List | Proof of Flo...
-------------------------------------------------------------
I live in New Delhi and love explaining programming concepts. I have done M.Tech(BITS Pilani) + B.Tech(PEC, Chandigarh) in Computer Science and am currently working as a software engineer in a MNC.
If you like my content, please like, share my videos and subscribe to the channel.
-------------------------------------------------------------
For Linked List tutorials, please refer to the below playlist:
• Linked List
For Binary tree tutorials, please refer to the below playlist:
• Tree Data Structures
For Binary search tree tutorials, please refer to the below playlist:
• Binary Search Tree
For in-depth Graph theory and implementation details, please refer to the below playlist:
• Graph Algorithms
#DataStructure,#LinkedList,#FitCoder,#Algorithm,#competitiveprogramming,#faang,#codinginterview