Documente Academic
Documente Profesional
Documente Cultură
Created by:
Mehak
UID: 23837
Introduction
WHAT IS LINKED LIST?
– Linear collection of data elements, called nodes.
– Connected by links, called pointers.
Complexity: O(n)
Example
Algorithm to count the number NUM of elements in
the list.
MEMORY ALLOCATION
Original lis
Inserting after a given node
Suppose an ITEM needs to be inserted at a given location LOC after
the node. If LOC=NULL, then insert the ITEM at the beginning of the
LIST.
**Complexity: O(n)
DELETION IN LINKED LIST
• Deleting from the beginning
• Deleting from the given location
• Deleting node with given ITEM information
Deletion at the beginning of Linked List
Algorithm:
DELETE(START,ITEM,LINK,AVAIL,LOC)
**Complexity: O(1)
Delete a node at given location