ppt on linked list,stack,queue

11
UNIVERSITY OF LUCKNOW ,LUCKNOW(U.P.) MASTER OF COMPUTER APPLICATION Data Structure & Algorithms using ’C’ -:Submitted By SRAJAN SHUKLA Department of Computer Science, University of Lucknow, Lucknow(U.P.)

Upload: srajan-shukla

Post on 08-Jan-2017

189 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Ppt on Linked list,stack,queue

UNIVERSITY OF LUCKNOW ,LUCKNOW(U.P. ) MASTER

OFCOMPUTER APPLICATION

Data Structure & Algorithms using ’C’

-:Submitted BySRAJAN SHUKLA

Department of Computer Science,

University of Lucknow,Lucknow(U.P.)

Page 2: Ppt on Linked list,stack,queue

2

Introduction to Linked list

• A linked list are one way list is linear collection of data element called nodes, where the linear order is given using pointers i.e. Each node is divided into two parts the first part contain the information of the element and the second part contain the address of the next node of the list which is called link filed of next pointer field.

• Each element is called node which has (info)information part and (pointer)pointer part.

Page 3: Ppt on Linked list,stack,queue

3

Types of Linked ListThere are mainly three types of linked list Singly linked list● Each node has only one link part that contains the address

of next node. Circular linked list● In this linked list the linked field of the last node contain

the address of the first node of list Doubly linked list● In this linked list all nodes are linked together by multiple

number of links which help in accessing both the successor and predecessor node from the given node position

Page 4: Ppt on Linked list,stack,queue

4

Circular Linked List● In this linked list the linked field of the last

node contain the address of the first node of list.

● A circular linked list has no end therefore it is necessary established the first and last node in such a linked list.

● A circular linked list can be used to traverse the same list again and again if needed.

● In this list the last node contains the address of first node in place of NULL.

Page 5: Ppt on Linked list,stack,queue

5

Circular Linked List

Page 6: Ppt on Linked list,stack,queue

6

Operation of Linked List

Some basic operation of linked list are as follows:-

Insertion of a nodeInserting a node before first nodeInserting a node after last nodeInserting a node at particular position Deletion of a nodedeleting a node before first node deleting a node after last node deleting a node from particular position

Page 7: Ppt on Linked list,stack,queue

7

StackIt is a linear type of data structure that works

on the concept of Last In First Out(LIFO).In a stack element can be inserted by the

same and single end. When an element is inserted into stack we

can say that insertion of element into stack is called PUSH operation and deletion of stack is called POP operation.

Page 8: Ppt on Linked list,stack,queue

8

Implementation of Stack

The stack can be implemented into two ways

Using array(static implementation)The size of stack can’t be changed further.Size of array is declared before the start of

operation.Using pointer(dynamic implementation)It is also called linked list representation and

uses pointers to implement the stack type.

Page 9: Ppt on Linked list,stack,queue

9

QueueIt is an also linear type data structure works

on the concept of First In First Out(FIFO). The element can be inserted from both end.

If an element is inserted from end a then it can be deleted by next end i.e. B and vice-versa.

In a queue new element are added to the queue from one end called rear end, and the element are always removed from other end called front end.

Page 10: Ppt on Linked list,stack,queue

10

Types of queue

There are mainly three types of queue:- Circular queueA circular queue is one in which the insertion of a new

element is done at the very first location of the queue if the last location of the queue is full.

Double ended queueIn this the insertion and deletion operations are

performed from both ends i.e. from front end or from last end.

Priority queueElements in this queue are assigned according to their

priority.

Page 11: Ppt on Linked list,stack,queue

11

THANK YOU!!!Any Question??