Linked List
A linked list is a linear data structure made up of nodes, where each node stores a value and a reference (pointer) to the next node in the sequence, allowing efficient insertion and removal without shifting other elements.
18 resources across 3 libraries
Glossary Terms(5)
Recursion
Recursion is a programming technique in which a function solves a problem by calling itself on smaller subproblems, combined with a base case that stops the re…
Big O Notation
Big O notation is a mathematical notation used in computer science to describe how an algorithm's running time or memory usage grows as the size of its input i…
Linked List
A linked list is a linear data structure made up of nodes, where each node stores a value and a reference (pointer) to the next node in the sequence, allowing…
Binary Search Tree
A binary search tree (BST) is a node-based data structure in which each node has at most two children, and every node's left subtree contains only values less…
Pointer
A pointer is a variable that stores a memory address rather than a value directly, allowing a program to reference and manipulate data indirectly through that…
Study Notes(1)
Interview Questions(12)
Difference Between Array and Linked List
An array stores elements in contiguous memory with fixed-size, index-based access in O(1), while a linked list stores elements as nodes scattered in memory, ea…
What is a Doubly Linked List?
A doubly linked list is a sequence of nodes where each node stores a value plus pointers to both the next and the previous node, allowing traversal in either d…
What is the Two Pointer Technique?
The two pointer technique uses two index variables that move through a data structure — typically a sorted array or a linked list — to solve problems in O(n) t…
What is Hashing with Chaining?
Hashing with chaining resolves hash collisions by storing every key that maps to the same bucket in a linked list (or dynamic array) attached to that bucket, s…
What is a Skip List?
A skip list is a probabilistic, layered linked-list structure that keeps elements sorted and adds multiple levels of 'express lane' pointers above the base lis…
How Do You Merge K Sorted Linked Lists?
K sorted linked lists are merged efficiently in O(N log k) time by using a min-heap of size k that always holds the current head of each list, repeatedly poppi…
How Do You Reverse a Linked List in Groups of K?
Reversing a linked list in groups of k means walking the list k nodes at a time, reversing the pointers within each full group of k while leaving any trailing…
How Do You Detect a Cycle in a Linked List?
You detect a cycle in a linked list by walking it with two pointers moving at different speeds — a slow pointer advancing one node at a time and a fast pointer…
What is Floyd’s Cycle Detection Algorithm?
Floyd’s cycle detection algorithm, also called the tortoise-and-hare algorithm, finds whether a linked structure contains a cycle and, with a second phase, loc…
How Do You Find the Middle of a Linked List?
You find the middle of a linked list in a single pass using the slow-fast pointer technique: advance a slow pointer one node at a time and a fast pointer two n…
How Do You Clone a Linked List with a Random Pointer?
You clone a linked list where each node has both a next pointer and a random pointer (which may point anywhere in the list or to null) by first mapping every o…
How Do You Flatten a Multilevel Linked List?
You flatten a multilevel doubly linked list, where nodes can have a child pointer to a separate sublist in addition to next and prev, by depth-first traversal:…