Professional Documents
Culture Documents
Contents
Introduction
Why Linked Lists?
Linked vs Arrays
Variations of Linked Lists
Basic Operations
Programs
Introduction
Limitations of Arrays
The size of array is fixed i.e. static structure.
Significant amount of memory is wasted when
speculating the upper limit on the number of elements
in advance.
Inserting or deleting in array of elements is expensive
as memory has to be arranged for the new elements and
then the shifting is done.
Linked Lists vs Arrays
Non-primitive data Primitive data structure.
structure. Static memory allocation.
Dynamic memory Random access.
allocation. Continous memory
Sequential access. allocation.
Creation
Insertion
Deletion
Traverse
Search
Reverse
Length
Programs
Insertion at head
Programs
Insertion at tail
Programs
Insert at specific position
Programs
Delete at specified position
Programs
Delete all occurences
of node with given key
Programs
Reverse a linked list
Programs
Merge two sorted linked lists
Programs
Cycle detection or Loop detection
Programs
Find intersection point or merging point
Programs
Find middle element of the list
Programs
Swap nodes without swapping the data
Programs
Add two numbers repesented as linked lists
Programs
Delete duplicate node values
Is linked list a palindrome?
Sort linked list sorted on absolute values
Insert in sorted manner
Subtract two numbers represented as linked lists
Flatten a multilevel linked list
Delete N nodes after M nodes
Convert Binary tree to Circular Doubly Linked List
Quick Sort and Merge Sort on Linked lists