Technical Interview Problems in Python: Linked Lists

Lesson 1 of 1

- 1Linked lists are a sequential data structure. A linked list consists of nodes which store data and a link to another node. Each node knows its location, what value it holds, and where to find the n…
- 2Start by extending the functionality of the LinkedList class. Write a method to insert a node anywhere in the linked list based on an input number. 0 means inserting at the head, 1 is the node foll…
- 3For our second problem, we’ll continue extending our LinkedList class. Write a method which returns the node that is
**n nodes from the tail of the linked list.**If n is 0, we would return the t… - 4Our next problem assumes a sorted linked list. Nodes held at .next will have values greater than or equal to the current node’s value. Write a method on the LinkedList class which removes all dupl…
- 5The next problem involves working with two different linked lists. You’ll need to write a function outside of the LinkedList class. Given two
*sorted*linked lists as input, your function should r… - 6Nodes within a linked list can be referenced multiple times. We’ll explore this idea with a partially merged linked list. # a -> b # \ # -> c -> e # / # d -> f In this exam…
- 7What if instead of progressing through nodes from head to tail, we wanted to move from tail to head? We can reverse a linked list to make this the default traversal! Let’s examine what we’ll need …
- 8As we saw with the merge point problem, more than one node can reference another node. These references can create a
*cycle*in the linked list where the traversal will loop back on itself. # -… - 9For our last problem, we’re going to pretend that each node in a linked list holds the digit of a number. The tail node holds the most significant digit and the head node holds the least significan…
- 10Linked lists are a sequential data structure like lists, but they store data in a different way. Lists store data sequentially in the computer’s memory. Linked lists track the internal memory addre…

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory