Data Structures - Algorithms_PC-CS391

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

MCKV Institute of Engineering

243, G.T.Road(N), Liluah, Howrah-711204

Data Structures & Algorithms Lab (PC-CS391)


Stream: CSE(DS) 3rd Semester, Academic Year: 2024-25
List of Assignments
Linear Data Structure:
1. Write a Menu Driven C Program to create an integer array and populate it with some
data. Then perform the following operations with user choice:
a) Insert an element: i) at beginning, ii) at end iii) at the any position of the array.
b) Delete an element from i) beginning ii) from end iii) from a given position of the array.
c) Replace the element of a given position with another number.
d) Search if an element exists in the list (using linear search).
e) Display the array elements.

2. Write a Menu Driven C Program to implement Stack operations using array:


a) Insert an element in the STACK: void PUSH( int )
b) Delete an element from the STACK: int POP()
c) Display all elements of the STACK: void DISPLAY().
Write the code in such a way that it can produce output according to user choice.
Ex: push(31), push(71), push(91), display(), pop(), display()….

3. Write a Menu Driven C Program to implement QUEUE operations using array:


a) Insert an element in the QUEUE: ENQUE(char)
b) Delete an element from the QUEUE: char DELQUE()
c) Display all the elements of the QUEUE: DISPLAY()
Write the code in such a way that it can produce output according to user choice:
Ex: enque(a), enque(b), enque(p), display(), delque(), display()…

4. Write a Menu Driven C Program to implement Circular QUEUE operations using


Array
a) Insert an element in the Circular QUEUE: CENQUE()
b) Delete an element from the Circular QUEUE: CDELQUE()
c) Display elements of the Circular QUEUE: CDISPLAY()

Application of Stack:
5. a) Write a C Program to convert an infix expression to its equivalent Postfix Expression.
b) Write a C Program for Evaluating a Postfix Expression. (Optional)
(Test case expressions will be supplied during lab session)

Programs using Dynamic Memory Allocation:


6. Write a Menu Driven C Program to implement the following after creating a Single
Linked List(SLL)
a) Insert a node (insert_at_beg / insert_at_end / insert_at_pos) in SLL
b) Delete a node (del_from_beg / del_from_end / del_at_pos) from SLL
c) Traverse the nodes of the list.
Application of Single Linked List:
7. a) Write a C programs to implement Stack using Single Linked List.
b) Write a C programs to implement Queue using Single Linked List.

8. Write a C Program to add two Polynomials using Single Linked List (SLL).

Implementation of Sorting & Searching Algorithms:


9. Write a Menu Driven C Program to sort data of an integer array using the following
sorting algorithms. Use functions for each sorting algorithm and input the array elements
within respective cases.
a) Bubble Sort
b) Insertion Sort
c) Selection Sort
d) Merge Sort
e) Quick Sort

10. Write a Menu Driven C Program to search an element from a sorted integer array using
the following searching algorithms. Use functions for each algorithm and compare the no.
of iterations required when both functions are run for the same set of inputs.
a) Binary Search
b) Interpolation Search

Implementation of Non Linear Data Structure:


11. Write a C Program to Construct a Binary Search tree and traverse the tree in a) Preorder,
b) Inorder, c) Postorder.

12. Write a C Program to Construct an AVL tree and traverse the tree in Inorder.(optional)

Extra Assignments:
1. Write a C Program to express a Sparse Matrix in its 3-tuple form. Explain the efficient
use of memory in tuple representation. (Take a 7x7 matrix with 3 nonzero elements.)
(Application of array, Explanation of Space complexity)
2. Write a C Program to implement Linear Queue using two Stacks. (Application of
Stack)
3. Write a C program to implement Linear probing Hash functions. Resolve collision by
any collision resolution technique.

Signature of Faculty & Date Signature of HOD & Date

You might also like