Linked List Problems

ยท

1 min read

Reverse a Linked List

Find the middle of LinkedList

Merge two sorted Linked List (use method used in mergeSort)

to simplify code, we can use a dummyHead to avoid handling head==NULL cases

Remove N-th node from back of LinkedList

Add two numbers as LinkedList

Delete a given Node when a node is given.(0(1) solution)

Find intersection point of Y LinkedList

The above code even handles the case when there is no intersection

The intuition is that one p1 (longer list) pointer reaches the second list after a delay of l1-l2 steps , so when the second iteration starts , p1 and p2 have zero offset and moving ahead they collide at a single point

Detect a cycle in Linked List

Reverse a LinkedList in groups of size k.

Check if a LinkedList is palindrome or not.

Find the starting point of the Loop of LinkedList

Flattening of a LinkedList

Rotate a LinkedList

Clone a Linked List with random and next pointer

ย