13-04-2013, 04:52 PM
(Linear, Circular, Doubly) Linked Lists, Stacks, Queues, Trees
Linear, Circular.pdf (Size: 200.59 KB / Downloads: 179)
Introduction to Linked Lists
Each bead connected to the
next through a link
Can change the order of the
beads by changing the
link/connection
Bead ~ Data
Linked beads ~ Linked list
of data
Uses and Operations on Linked Lists
Linear linked list: last element is not connected to anything
Circular linked list: last element is connected to the first
Dynamic: Size of a linked list grows or shrinks during the
execution of a program and is just right
Advantage: It provides flexibility in inserting and deleting
elements by just re-arranging the links
Disadvantage: Accessing a particular element is not easy
There are three major operations on linked lists
Recap of Linear Linked Lists
Each element: data + link (pointer to next element)
Element is also called a “node”
Head: address of first element
Last element pointer: NULL
All operations done using pointers
Allocation of space of element
Assigning and accessing data values