4.4. Summary

Although they are simple data structures, problems about linked lists often arise in interviews focusing on C/C++ experience as a way to determine whether a candidate understands basic pointer manipulation. Each element in a singly-linked list contains a pointer to the next element in the list, while each element in a doubly-linked list points to both the previous and the next elements. The first element in both list types is referred to as the head, while the last element is referred to as the tail. Circularly-linked lists have no head or tail; instead, the elements are linked together to form a cycle.

List operations are much simpler to perform on doubly-linked lists, so most interview problems use singly-linked lists. Typical operations include updating the head of the list, traversing the list to find a specific element from the end of the list, and inserting or removing list elements.

Get Programming Interviews Exposed: Secrets to Landing Your Next Job, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.