DS Assignment
DS Assignment
1. Write a C++ Program to construct a Class stack of integers and to perform the following operations on it:
a. Push
b. Pop
c. Display
The program should print appropriate messages for stack overflow, stack underflow, and stack empty.
2. Write a C++ Program to simulate the working of a queue of integers using an array. Provide the following
operations:
a. Insert
b. Delete
c. Display
3. Write a C++ Program to simulate the working of a circular queue of integers using an array. Provide the
following operations:
a. Insert
b. Delete
c. Display
4. Write a C++ Program to construct a singly linked list and to perform the following operations on it:
a) The insertion operation
i. At the front of a list
ii. At the back of the list
iii. At any position in the list
b) The deletion operation
i. At the front of a list
ii. At the back of the list
iii. At any position in the list
c) Displaying all the nodes in the list
5. Write a C++ Program to construct a stack of integers using singly linked list and to perform the
following operations:
a. Push
b. Pop
c. Display
The program should print appropriate messages for stack overflow and stack empty.
6. Write a C++ program to construct a queue of integers using singly linked list and to perform the
following operations:
a. Insert
b. Delete
c. Display
7. Write a C++ Program to construct a doubly linked list and to perform the following operations on it:
a) The insertion operation
i. At the front of a list
ii. At the back of the list
iii. At any position in the list
8. Write a C++ Program to construct a Circular (Singly & Doubly) linked list and to perform the following
operations on it:
a) The insertion operation
i. At the front of a list
ii. At the back of the list
iii. At any position in the list
10. Write a program to print the middle element of a given linked list (There is an odd number of elements in
list).