Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Detect & Remove Loop in Linked List - Approach Discussion + Optimised Implementation

CodeHelp - by Babbar via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Learn how to detect and remove loops in linked lists through this comprehensive 51-minute video tutorial. Explore multiple approaches, including cycle detection and Floyd's cycle detection algorithm, with detailed explanations and code implementations. Understand the underlying principles, proofs, and optimizations for finding the starting node of a loop and removing it from the linked list. Follow along with step-by-step coding demonstrations, gain insights into null checks, and receive homework assignments to reinforce your understanding of this important data structure concept.

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

Reviews

Start your review of Detect & Remove Loop in Linked List - Approach Discussion + Optimised Implementation

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.