Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

School of Computer Science & IT, DAVV

Data Structures using C++


Lab 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

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

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

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

9. Write a program to create and display a polynomial.

10. Write a program to print the middle element of a given linked list (There is an odd number of elements in
list).

11. Write a program to Count the number of nodes of a given linked.

12. Write a program to Sort the element of linked list.

13. Write a program to Search a particular data in a singly linked list.

14. Write a C++ Program:


a. To construct a binary search tree of integers.
b. To traverse the tree using all the methods i.e., inorder, preorder and postorder.
c. To display the elements in the tree.

You might also like