You are on page 1of 35

Lab Digital Assignment -1

Data Structure and Algorithm (CSE-2011)

Name – Govind Maheshwari


Reg No. – 20BCE2802
Slot – L31+32

Experiment 1 :
a) Implementation of stack data structure and its operation
Code :
Output :

a) Application of stack data structure (Tower of Hanoi) :

Code:
Output :
Experiment-2 :
a) Implementation of Queue using array :
Code:
Output :
➢ Inserting elements into the queue:

The queue elements are : 1 2 3 4


➢ Deleting elements from queue:
➢ Display all the elements :

➢ Exit the queue:


b) Operations in Queue Data Structure [ enqueue(), dequeue() ] :
Code:
Output :

c) Simple Queue :
Code :
Output :
➢ Insertion of elements :
➢ Display elements :

➢ Deletion of elements :
d) Circular Queue :
Code:
Output :

e) Doubly ended queue :


Code:
Output :

f) Application of queue :
The FCFS(first come first serve) is one of the application of queue.
Code:
Output :
Experiment 3:
a) Singly Linked list –
Code :
Output :

b) Doubly Linked list –


Output :
c) Circular Singly Linked list :

Code:
Output :
This code creates a class CircularLinkedList that provides several
basic operations such as insert element at begin, insert element
at end, delete element at begin, display the list.

d) Circular Double Linked list :

Code:
Output :

You might also like