Вы находитесь на странице: 1из 11

Data Structure & Algorithms

using ’C’

UNIVERSITY OF LUCKNOW ,LUCKNOW(U.P.)


MASTER
OF
COMPUTER APPLICATION

-:Submitted By
SRAJAN SHUKLA
Department of Computer Science,
University of Lucknow,
Lucknow(U.P.)
Introduction to Linked list
2

• 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.
Types of Linked List
3

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
Circular Linked List
4

● 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.
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.
THANK YOU!!!
Any Question??

11

Вам также может понравиться