# DATA STRUCTURES AND ALGORITHM LABORATORY Syllabus for NIT Jalandhar

CS-219 DATA STRUCTURES AND ALGORITHM LABORATORY [0 0 2 1]

Write Program in C or C++ for following.

1.

Write a C+ program to the following operations on stack of integers:

a> push b>pop c> display

The program should print appropriate messages for stack overflow, stack Underflow & stack empty.

2.

Write a C++ program to convert & print a given valid parenthesized in fix Arithmetic expression to postfix expression. The expression consists of single character operands & + , – ,*,/ operators .

3.

Write a c program to evaluate a valid suffix / postfix expression using a Stack, assume that the suffix / postfix expression is read as a single line consisting of non negative single digit operands & binary arithmetic operands. The arithmetic operators are + (ADD), – (subtract), *(multiply) & / (divide).

4.

Write a C++ program to simulate the working a queue of integers using an array. Provide the a) insert b) delete c) display

5.

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

6.

Write a program to design a priority queue which is maintained as a set of queue (assume a maximum of 3 queues). The elements are inserted based upon the given priority. The deletion of an element is to be done starting from the 1st queue, if it is not empty .If it is empty ,The elements from the 2nd queue will be deleted & so on.

7.

Write a C++ program using dynamic variable & pointers to construct a singly linked list consisting of the following information in each node. Student id (integer), student name( character string) & semester(integer). The operations to be supported are

a)

inserting in front of list

b)

Deleting a node based on student id, if the specified node is not present in the list, error message should be displayed

c)

Searching a node based on student id , if the specified node is not present in the list, error message should be displayed

d)

Displaying all the nodes in the list

8.

Write a C++ program using dynamic variables & pointers to construct an ordered(ascending) singly linked list based on the rank of the student, where each node consists of the following information student id( integer)student name(character), rank(integer)

9.

Write a C++ program using dynamic variables & pointers to construct a singly linked list to perform the operations of a stack of integers

a

) Push b) pop c) display

1

0. The program should print appropriate message for stack overflow & stack empty

Department of Computer Science and Engineering

24

11

. Write a C++ program to support the following operations on a doubly linked where each node each node consists of integers

a)

Create a doubly linked list by adding each node front

b)

Insert a new node to the left of the node whose key value is read as a input

c)

Delete the node of a given data, if it is found, otherwise display appropriate message

d)

Display the content of the list

12

. Write C++ program

a)

To construct a binary search tree of integers

b) T

o traverse the tree using all the methods i.e. inorder, preorder & postorder to display the elements in the tree

13

. Write C++ program for the following searching techniques over a list of integers.

a>

Linear search,

b>

Binary search

14

. Write a C++ program to sort a list of N integers using the quick sort algorithm.

15.

Write a C++ program to sort a list of N strings using the insertion sort algorithm.

16.

Write a C++ program to sort a list of N integers using Heap sort algorithm.