Lesson 4 of 10 • 0 upvotes • 5:47mins
Method 2 linked list How to detect loop using Floyd's cycle detection algorithm This solution requires modifications to basic linked list data structure. Have a visited flag with each node. Traverse the first linked list and keep marking visited nodes. Now traverse second linked list, If you see a visited node again then there is an intersection point, return the intersecting node. This solution works in O(m+n) but requires additional information with each node. A variation of this solution that doesn’t require modification to basic data structure can be implemented using hash. Traverse the first linked list and store the addresses of visited nodes in a hash. Now traverse the second linked list and if you see an address that already exists in hash then return the intersecting node.
10 lessons • 1h 21m
Top 10 Algorithms in Interview Questions: Introduction
6:31mins
Dynamic Programming Floyd Warshall Algorithm
10:19mins
Depth First Search or DFS for a Graph
5:47mins
Method 2 Linked List (make visited nodes)
5:47mins
Breadth First Search or BFS for a Graph
9:27mins
Boggle (Find all possible words in a Board of Characters)
8:21mins
Kruskal's Minimum Spanning Tree Algorithm
5:53mins
Given a singly Linked List and a position, delete a Linked List node at the given position
7:45mins
Disjoint set or (union - find) Algorithm of a Graph
10:07mins
Finding Bridges in a graph intro to the Algorithm
11:39mins