Chapter 2 List and Linked List
Chapter 2 List and Linked List
DATA STRUCTURES
CHAPTER 2 :
LIST AND LINKED LIST
LIST
• a linked list is data structure that consists of a sequence of data records such
that in each record there is a field that contains a reference to the next record in
the sequence
• benefit of a linked list over a conventional array is that the order of the linked
items may be different from the order that the data items are stored in memory
or on disk.
• linked lists allow insertion and removal of nodes at any point in the list
EXAMPLE OF LINKED LIST
BASIC CONCEPT OF LINKED LIST
Add and delete item required more Add & delete item required less
steps. steps.
Suitable for simple list. Suitable for larger list.
• Linked lists are a dynamic data structure, allocating the needed memory while
the program is running.
• Insertion and deletion node operations are easily implemented in a linked list.
• Does not require any extra space therefore it does not waste extra memory
• They can reduce access time and may expand in real time without memory
overhead.
DISADVANTAGES OF LINKED LIST
A double linked list whose nodes contain three fields: an integer value, the link forward to the next
node, and the link backward to the previous node
TYPES OF LINKED LIST
45 65 38 76
head tail
The address of the first node in the list is stored in a separate location called head / first
OPERATION IN LINKED LIST
2. Create node
- To create one new source for connecting items in the linked list.
Structure of a node
data link
head tail
OPERATION IN LINKED LIST
50
102
head
45 38 76 102
LINKED LIST STRUCTURE
OPERATION IN LINKED LIST :
DECLARING LINKED LIST
OPERATION IN LINKED LIST: CREATE
HEAD & NODE
OPERATION IN LINKED LIST: INSERT
OPERATION IN LINKED LIST: DELETE