close
close

DSA: LinkedList – questions to prepare for interviews

DSA: LinkedList – questions to prepare for interviews

DSA: LinkedList – questions to prepare for interviews

1. Linked List Basics

· Introduction to linked lists

· Creating a singly linked list

· Cycle through a linked list

· Insert at the beginning

· Insert at the end

· Insert at a specific position

· Delete a node by value

· Delete one node per position

· Delete the first node

· Delete the last node

2. Search and length operations

· Search for an element in a linked list

· Find the length of a linked list

· Count occurrences of a certain element

· Find the center of a linked list

· Finding the Nth node from the end

· Detect a loop in a linked list (Floyd’s cycle detection)

· Remove a loop from a linked list

· Find the beginning of a loop

· Check whether a linked list is circular

· Check whether a linked list is a palindrome

3. Reversal of linked lists

· Invert a linked list iteratively

· Recursively invert a linked list

· Invert a linked list in groups of K

· Reversing alternate K-nodes

· Rolling back the first half of the linked list

· Rolling back the second half of the linked list

· Reverse junctions between M and N

· Invert each alternate node in a linked list

· Inverse pairs in a linked list

· Reverse a doubly linked list

4. Linked list with recursion

· Recursive approach to traversal

· Recursive approach to search

· Recursive approach to insertion

· Recursive approach to deletion

· Recursive merging of two sorted linked lists

· Recursive inversion of linked list

· Recursive approach to flatten a multi-level linked list

· Recursive palindrome checking

· Recursive separation of even and odd nodes

· Recursive pairwise exchange of nodes

5. Two-pointer techniques in linked lists

· Finding the intersection of two linked lists

Detect and remove loop (two-point method)

· Finding the middle node (tortoise and hare approach)

· Merge two sorted linked lists

· Detecting intersections in circularly linked lists

· Reorder linked list (odd-even nodes)

· Find the intersection of two linked lists

· Sort a linked list using merge sort (two pointers)

· Quickly sort by linked list using two pointers

· Invert nodes in a linked list with two pointers

6. Advanced linked list operations

· Merge K sorted linked lists

· Flattening a multi-level linked list

· Clone a linked list with random references

· Rotate a linked list left by K position

· Rotate a linked list right with K positions

· Separate even and odd nodes in a linked list

· Add two numbers represented by linked lists

· Subtract two numbers represented by linked lists

· Multiply two numbers represented by linked lists

· Divide two numbers represented by linked lists


7. Circular linked lists

· Introduction to circular linked lists

· Creating a circular linked list

· Insertion at the beginning of a circularly linked list

· Insertion at the end of a circularly linked list

· Removal from a circularly linked list

· Convert a singly linked list into a circularly linked list

· Split a circularly linked list into two halves

· Josephus problem in circular linked list

· Detect loop in a circular linked list

· Traverse a circularly linked list

8. Doubly linked lists

· Introduction to doubly linked lists

· Create a doubly linked list

· Insertion at the beginning of a doubly linked list

· Insertion at the end of a doubly linked list

· Insertion after a specific node in a doubly linked list

· Removal of a node from a doubly linked list

· Invert a doubly linked list

· Flattening a doubly linked list

· Convert a binary tree to a doubly linked list

· Traverse a doubly linked list in both directions

9. Specialized linked lists

· Skip List implementation

XOR linked list (memory efficient double linked list)

· Flatten a linked list with child references

· LRU cache implementation using doubly linked list

· Implemented Stack using Linked List

· Implement queue using linked list

· Convert binary numbers in linked list to integer

· Clone a multi-level linked list

· Add 1 to a number represented by a linked list

· Implementation of a priority queue using a linked list

10. Complex Linked List Problems

· Intersection of Y-shaped linked lists

· Swap nodes in a linked list without exchanging data

· Rotate a linked list into blocks of K

· Remove nodes that have a larger value on the right side

· Remove N nodes after M nodes

· Flatten a linked list, where each node has a next and child pointer

· Separate 0’s, 1’s and 2’s in a linked list

· Flatten a linked list from linked lists

· Convert a sorted linked list to a balanced BST

· Rearrange a linked list in zigzag fashion