Lecture3 Linked List
Lecture3 Linked List
Introduction
• Array is a static data structure; continuous memory usage
• There is need for an alternative where any part of memory is used
• “I am Swaib, I know where Principal sits”. Swaib need not to sit next
to Principal.
• Swaib + Principal’s address is a node where Swaib is data value and
principal’s address is location of next node(data).
• Node
Data Link
Linked List
• Is an ordered collection of finite, homogenous data elements
(nodes)where the linear order is maintained by pointers/link.
Header
• Node1 Node2 Node3
Null pointer
• The header node has no data value while the last node points to no
data
• Linked list can be single, double or circular linked list
Nodes
• Each element of a Linked List is a separate Node object
Data Link
Header