Beruflich Dokumente
Kultur Dokumente
• Definition :
• List is a collection of data, element, component or objects with similar
data type
!
List is a collection of data, element, component or objects with similar data
type
• 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
Structure of a node
data link
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
3. Check the linked list : full/empty
- Check either linked list full or empty.
Structure of a linked list = FULL
45 65 38 76
head tail
Structure of a linked list = EMPTY
head tail
OPERATION IN LINKED LIST
4. Insertion node in the list
- Add an item on linked list.
Structure of a linked list = Insert 50 (in front)
head
45 65 38 76
tail
45
OPERATION IN LINKED LIST
4. Insertion node in the list
- Add an item on linked list.
Structure of a linked list = Insert 80 (in middle)
head
45 65 38 76
tail
80
OPERATION IN LINKED LIST
4. Insertion node in the list
- Add an item on linked list.
Structure of a linked list = Insert 102 (at last)
head tail
45 65 38 76
102
OPERATION IN LINKED LIST
5. Delete node in the list
- Delete one item from linked list.
head tail
45 65 38 76
102
Structure of a linked list = Delete 65
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
ADVANTAGES OF LINKED LIST
• Dynamic data structure, and therefore the size of the linked list
can grow or shrink in size during execution of the program.
• Does not require any extra space therefore it does not waste extra
memory.
• Provide flexibility in rearranging the items efficiently.
DISADVANTAGES OF LINKED LIST
Add & delete item required uch Add & delete item required less
steps. steps.
Suitable for less of list. Suitable for larger of list.