Linked List in Data Structures
(Class Notes)
Data Structures - Class Notes
Introduction to Linked List
• Linked List is a linear data structure
• Unlike arrays, elements are not stored in
contiguous memory
• Each element (node) contains data and a
pointer to the next node
Basic Terminology
• Node: Basic element of linked list (data +
pointer)
• Head: First node of linked list
• Tail: Last node pointing to NULL
• Pointer: Stores the address of the next node
Types of Linked List
• Singly Linked List: Each node points to the next
node
• Doubly Linked List: Each node points to next
and previous nodes
• Circular Linked List: Last node points back to
the head
• Doubly Circular Linked List: Combines both
features
Operations on Linked List
• Traversal: Visiting each node sequentially
• Insertion: Adding node at beginning, end, or
middle
• Deletion: Removing node from beginning,
end, or specific position
• Searching: Finding an element in the list
• Updating: Changing data of a node
Advantages of Linked List
• Dynamic size allocation
• Efficient insertion and deletion compared to
arrays
• No memory wastage (unlike arrays)
• Useful for implementing stacks, queues,
graphs
Disadvantages of Linked List
• More memory required (extra pointer per
node)
• Sequential access (no direct access like arrays)
• Complex implementation compared to arrays
• Cache unfriendly due to scattered memory
allocation
Applications of Linked List
• Dynamic memory management
• Implementing stacks and queues
• Polynomial representation
• Graph adjacency representation
• Undo/Redo functionality in text editors
Summary & Key Points
• Linked List is a dynamic linear data structure
• Types: Singly, Doubly, Circular
• Efficient for insertions/deletions but slower
for access
• Forms the basis for advanced data structures