KEMBAR78
Ppt on Linked list,stack,queue | PPTX
U N I V E R S I T Y O F L U C K N O W , L U C K N O W ( U . P . )
M A S T E R
O F
C O M P U T E R A P P L I C A T I O N
Data Structure & Algorithms
using ’C’
-:Submitted By
SRAJAN SHUKLA
Department of Computer Science,
University of Lucknow,
Lucknow(U.P.)
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.
2
Types of Linked List
There 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
3
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.
4
Circular Linked List
5
Operation of Linked List
6
Some basic operation of linked list are as
follows:-
Insertion of a node
 Inserting a node before first node
 Inserting a node after last node
 Inserting a node at particular position
Deletion of a node
 deleting a node before first node
 deleting a node after last node
 deleting a node from particular position
Stack
7
 It 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.
Implementation of Stack
8
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.
Queue
9
 It 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.
Types of queue
10
There are mainly three types of queue:-
 Circular queue
 A 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 queue
 In this the insertion and deletion operations are
performed from both ends i.e. from front end or
from last end.
 Priority queue
 Elements in this queue are assigned according to their
priority.
11
THANK YOU!!!
Any Question??

Ppt on Linked list,stack,queue

  • 1.
    U N IV E R S I T Y O F L U C K N O W , L U C K N O W ( U . P . ) M A S T E R O F C O M P U T E R A P P L I C A T I O N Data Structure & Algorithms using ’C’ -:Submitted By SRAJAN SHUKLA Department of Computer Science, University of Lucknow, Lucknow(U.P.)
  • 2.
    Introduction to Linkedlist • 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. 2
  • 3.
    Types of LinkedList There 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 3
  • 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. 4
  • 5.
  • 6.
    Operation of LinkedList 6 Some basic operation of linked list are as follows:- Insertion of a node  Inserting a node before first node  Inserting a node after last node  Inserting a node at particular position Deletion of a node  deleting a node before first node  deleting a node after last node  deleting a node from particular position
  • 7.
    Stack 7  It isa 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.
  • 8.
    Implementation of Stack 8 Thestack 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.
  • 9.
    Queue 9  It isan 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.
  • 10.
    Types of queue 10 Thereare mainly three types of queue:-  Circular queue  A 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 queue  In this the insertion and deletion operations are performed from both ends i.e. from front end or from last end.  Priority queue  Elements in this queue are assigned according to their priority.
  • 11.