Tech_Interview_Prep

Linked Lists

Singly/doubly linked lists, pointer manipulation, and the classic two-pointer patterns.

Q1.What is a node in a singly linked list composed of?

Q2.What is the time complexity to access the k-th element of a singly linked list?

Q3.What is the time complexity to insert a new node at the head of a singly linked list, given a pointer to the head?

Q4.Compared to an array, what is the main advantage of a linked list for insertions/deletions in the middle?

Q5.What additional pointer does a node in a doubly linked list have compared to a singly linked list?

Q6.What is the classic technique to detect a cycle in a linked list in O(1) space?

Q7.In Floyd's cycle detection algorithm, how do the two pointers move?

Q8.How do you find the middle node of a singly linked list in one pass?

Q9.What's the time complexity of reversing a singly linked list iteratively?

Q10.What extra space does the standard iterative in-place linked list reversal use?

Q11.What is a common approach to merge two sorted linked lists into one sorted list?

Q12.To remove the n-th node from the end of a linked list in one pass, what technique is used?

Q13.What is a "sentinel" (or "dummy") node used for in linked list problems?

Q14.What defines a circular linked list?

Q15.What's the time complexity of searching for a value in an unsorted singly linked list?

Q16.Why is binary search NOT efficient on a singly linked list even if it's sorted?

Q17.What is a key real-world use case where a doubly linked list is preferred, combined with a hash map?

Q18.How do you typically check if a singly linked list is a palindrome in O(1) extra space?

Q19.What happens if you forget to update the previous node's next pointer when deleting a node from a singly linked list?

Q20.When finding the intersection point of two singly linked lists that merge into one, what's a common O(n) time, O(1) space technique?

Q21.What is the space complexity of a recursive linked list traversal in terms of call stack usage?

Q22.Which scenario favors an array (or dynamic array) over a linked list?

Q23.What's the main memory overhead of a linked list compared to an array of the same elements?

Q24.In a doubly linked list, what is the time complexity to delete a node given a direct pointer/reference to that node?

Q25.What does it mean for a linked list traversal to have poor cache locality compared to an array traversal?