+ All Categories
Home > Documents > C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

Date post: 18-Jan-2016
Category:
Upload: theodora-black
View: 213 times
Download: 0 times
Share this document with a friend
16
C o n f i d e n t i a l Next Home Subject Name : Data Structure Using C Title : Linked Lists
Transcript
Page 1: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

C o n f i d e n t i a lNextHome

Subject Name : Data Structure Using C

Title : Linked Lists

Page 2: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

It consists of a sequence of nodes, each containing arbitrary data fields and

one or two references ("links") pointing to the next and/or previous nodes. A

linked list is a self-referential data type because it contains a pointer or link

to another datum of the same type. Linked lists permit insertion and removal

of nodes at any point in the list in constant time, but do not allow random

access.

The principal 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, allowing the list of items to be traversed in

a different order.

Several different types of linked list exist: Singly Linked List, Doubly

Linked List, and Circular Linked List.

Linked Lists

NextHome

Page 3: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By NitendraHierarchical Structure of Linear List

Linear Lists

Restricted

LIFO FIFO

General

Random General

Ordered

NextHome

Page 4: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

There are basic FOUR operations performed on linear lists

•Insertion of Nodes : an insertion can be made at the any of the lists

•Deletion of Nodes : Deletion from general list requires that the list be searched for the data to be deleted.

•Retrieval of Values : List retrieval requires that data be located in a list and presented to the calling module without changing the contents of the lists.

•Traversal in the List : List traversal is a special case of retrieval in which all the elements are retrieved in a sequence.

NextHome

Page 5: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

1. Singly Linked List

2. Doubly Linked List

3. Circular Linked List

Type of Linked Lists

NextHome

Page 6: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By NitendraSingly Linked List

6 300100 9 400 12 200 5 700 -10 NULL

Head Node Tail Node

100 300 400 200 700

Address PartData Part

Arbitrary Address of the Node

NextHome

Page 7: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

Insertion of a Node in Singular Link List : Insert node value 45 after node value 9

6 300100 9 400 12 200 5 700 -10 NULL

Tail Node

100 300 400 200 700

45 NULLHead Node

Insertable Node

600

6 300100 9 600 12 200 5 700 -10 NULL

Tail Node

100 300 400 200 700

45 400Head Node

Inserted Node

600

(1)

(2)

NextHome

Page 8: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

Deletion of a Node in Singular Link List : Delete node value 12

6 300100 9 400 12 200 5 700 -10 NULL

Tail Node

100 300 400 200 700

Head Node

(1)

6 300100 9 200 12 200 5 700 -10 NULL

Tail Node

100 300 400 200 700

Head Node

(2)

NextHome

Page 9: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By NitendraDoubly Linked List

7 6001009 300NULL100 91 NULL60086 200300

100 300 600 200

Head Node Tail NodeAddress Part

Data Part

NextHome

Page 10: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

Insertion of a Node in Doubly Link List : Insert node value 45 after node value 7

7 6001009 300NULL100 91 NULL60086 200300

100 300 600 200

Head Node Tail Node

45 NULLNULL

Insertable Node

700

7 7001009 300NULL100 91 NULL60086 200700

100 300 600 200

Head Node Tail Node

45 600300

Inserted Node

700

(1)

(2)

NextHome

Page 11: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

7 6001009 300NULL100 91 NULL60086 200300

100 300 600 200

Head Node Tail Node

Deletion of a Node from Doubly Link List : Delete node value 86

7 2001009 300NULL100 91 NULL30086 200300

Head Node Tail Node

100 300 600 200

(1)

(2)

NextHome

Page 12: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By NitendraCircular Linked List

6 300100 9 400 12 200 5 700 -10 100

Head Node Tail Node

100 300 400 200 700

NextHome

Page 13: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

Insertion of a Node in Circular Link List : Insert node value 44 after node value 12

6 300100 9 400 12 200 5 700 -10 100

Tail Node

100 300 400 200 700

44 NULL

6 300100 9 400 12 500 5 700 -10 100

Tail Node

100 300 400 200 700

44 200

(1)

(2)

500

500

NextHome

Page 14: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

Deletion of a Node from Circular Link List : Delete the node value 5

6 300100 9 400 12 200 5 700 -10 100

Tail Node

100 300 400 200 700

6 300100 9 400 12 700 5 700 -10 100

Tail Node

100 300 400 200 700

NextHome

Page 15: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra

• Large Numeric Arithmetic

• Optimum Utilization of Memory Space

• Represent Complex Structure – Tree, Graph

Application of Linked List

NextHome

Page 16: C o n f i d e n t i a l NextHome Subject Name: Data Structure Using C Title : Linked Lists.

QueuesQueuesQueuesQueues

Developed By Nitendra


Recommended