Detect & Remove Loop in Linked List - Approach Discussion + Optimised Implementation
CodeHelp - by Babbar via YouTube
Overview
Syllabus
- Introduction
- Promotion
- Approach #1 - Detect Cycle
- Code Approach #1 - Detect Cycle
- Approach #2 - Floyd Cycle Detection
- Code Approach #2 - Floyd Cycle Detection
- why this works ?
- Approach #3 - find starting node of Loop
- Proof - why this works ?
- Code Approach #3 - find starting node of Loop
- Approach #4 - Remove Loop from Linked List
- Code Approach #4 - Remove Loop from Linked List
- Merging all Logic - to detect & remove Loop
- Adding NULL Checks
- Homework and Summary
Taught by
CodeHelp - by Babbar