CSE21P6 - Data Structure Lab¶
Questions are grouped by handbook experiment/topic. The original term and experiment number are retained.
Array Operations and Elementary Programs¶
Term 201¶
Exp 1. Implementation of a program in C that show that
- Prime number within a given range.
- Fibonacci number within a given range.
Exp 2. Write a program to find the solution of the quadratic equation \(ax^2 + bx + c = 0\).
Term 211¶
Exp 1. Design, Develop and Implement a menu driven program in C for the following Array operations.
- Creating an Array of N integer elements.
- Display of Array elements with suitable headings.
- Inserting an element (
ele) at a given valid position (pos). - Deleting an element at a given valid position (
pos).
String Processing and Pattern Matching¶
Term 171¶
Exp 3. Write a program in C to find P = "a beautiful" pattern from text T = "Bangladesh is a beautiful country" and replace the text with "a developing" where the pattern P matches.
Exp 7. Write a C program which counts the number of times the word "cricket" appears in following short story S.
Cricket is the most popular sport in Bangladesh. In the year 2000 Bangladesh became a full member of the International Cricket Council, which allows the national team to play Test cricket. The Bangladesh national cricket team goes by the nickname of the Tigers.
Term 191¶
Exp 5. Write a C program which counts the number of times the work "cricket" appears in following short story S.
Cricket is the most popular sport in Bangladesh. In the year 2000 Bangladesh became a full member of the International Cricket Council, which allows the national team to play Test cricket. The Bangladesh national cricket team goes by the nickname of the Tigers.
Term 201¶
Exp 3. Write a program that performs the first pattern matching algorithm.
Linked Lists¶
Term 161¶
Exp 3. Write a program to implement insertion operation of a linked list.
Exp 4. Write a program to perform deletion operation of a linked list.
Term 171¶
Exp 8. Write a program in C to insert an item in a list using linked list.
Exp 9. Write a program in C to search an element in a linked list.
Term 191¶
Exp 3. Write a C program to search an element in a linked list.
Exp 4. Write a C program to delete a node from linked list.
Term 211¶
Exp 5. Implement Linked list of integer element 2, 4, 6, 8, 10. Take input from user an item to delete from the list and finally display the list of elements.
Exp 6. Design, Develop and Implement a menu driven Program in C for the following operations on Singly Linked List (SLL) of Student Data with the fields: Stu ID, Name, Batch, Sem, PhNo.
- Create a SLL of N Students Data by using front insertion.
- Display the status of SLL and count the number of nodes in it.
- Perform Insertion and Deletion at End of SLL.
- Perform Insertion and Deletion at Front of SLL.
Stack and Queue¶
Term 161¶
Exp 1. Write a program to implement different operations of queue.
Exp 5. Consider the following stack, where STACK is allocated N = 6 memory cells with following data items:
STACK: MAN, WOMAN, CHILD, KIDS, FATHER, MOTHER.
Now write a C program to implement the stack using linked list concept for the following operations.
POP(STACK, ITEM).POP(STACK, ITEM).PUSH(STACK, BROTHER).PUSH(STACK, SISTER).
Term 171¶
Exp 4. Write a program in C to implement the following operation of stack:
- PUSH
- POP
- Display
Term 191¶
Exp 7. Write a program in C to implement the following operation of stack:
- PUSH
- POP
- Display
Term 201¶
Exp 5. Write a program to implement stack using array data structure.
Exp 10. Given an array arr[] of size N, enqueue the elements of the array into a queue and then dequeue them.
Input:
Output:
Your task:
You don't need to read any input. Your task is to complete the functions push() and pop(). The function push() takes the array and its size as the input parameters and returns the queue formed, and the function pop(), takes the queue as the input parameter and prints the elements of the queue.
Term 211¶
Exp 3. Write a program in C to implements the following operations of stack:
- PUSH
- POP
- Display
Exp 4. Design, Develop and Implement a menu driven program in C for the following operations on Circular QUEUE of Characters (support the program with appropriate functions for each of the operations)
- Insert an Element on to Circular QUEUE.
- Delete an Element from Circular QUEUE.
- Demonstrate Overflow and Underflow situations on Circular QUEUE.
- Display the status of Circular QUEUE.
Expression Conversion and Evaluation¶
Term 161¶
Exp 2. Write a program to implement postfix evaluation algorithm for finding solution of a given postfix expression.
2 3 4 + * 6 -7 8 + 3 2 + /
Exp 7. Write a C program to evaluate the following infix expression:
P = 10/(8-4)+2*(10+04)
Term 191¶
Exp 11. Write a C program to evaluate the following infix expression:
P = 20/(8-4)+2*(10+04)
Term 201¶
Exp 6. Write a program to convert the given infix expression to it's postfix format.
Exp 11. Write a program to evaluate the following of prefix expression: - + 8 / + 6 3 2
Term 211¶
Exp 8. Design, develop, and implement a program for converting an infix expression to postfix expression. Program should support for both parenthesized and free parenthesized expressions with the operators: +, -, *, /, % (Remainder), ^ (power) and alphanumeric operands.
Recursion¶
Term 171¶
Exp 10. Write a program in C to solve the Tower of Hanoi problem using recursion.
Term 191¶
Exp 9. Write a C program to solve the Tower of Hanoi problem using recursion.
Term 201¶
Exp 7. Write a program to implement Tower of Hanoi problem.
Trees and Heaps¶
Term 161¶
Exp 6. Write a program to create a Binary Search Tree of \(n\) elements and then display the elements (preorder, inorder and postorder) of the tree.
Exp 10. Write a program to create a Maxheap of \(n\) elements and then display the elements of the heap.
Term 211¶
Exp 10. Design, Develop and Implement a menu driven Program in C for the following operations on Binary Search Tree (BST) of Integers.
- Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2.
- Traverse the BST in Inorder, Preorder and Post Order.
- Search the BST for a given element (
KEY) and report the appropriate message. - Delete an element (
ELEM) from BST.
Exp 12. Write a C program to perform the following operations.
- Insertion into an AVL-tree.
- Deletion from an AVL-tree.
- Search for a key element in an AVL tree.
Graph Traversal and Shortest Path¶
Term 201¶
Exp 8. Write a program to implement DFS algorithm.
Term 211¶
Exp 7. Write a program to implement BFS algorithm.
Exp 9. Write a program to implement the traversal algorithm for Depth first traversal.
Exp 11. Write a program to implement the shortest path using Dijkstra's algorithm.
Sorting, Searching, and Hashing¶
Term 161¶
Exp 8. Write a C program to sort the following elements using merge sort algorithm. All elements must be taken from keyboard.
44, 33, 11, 55, 77, 100, 42, 60, 99, 25, 88, 66.
Exp 9. Write a C program to sort the following elements using Quick sort algorithm. All elements must be taken from keyboard.
44, 33, 11, 55, 77, 100, 42, 60, 99, 25, 88, 66.
Term 171¶
Exp 1. Write a program in C to sort the following elements using Quick Sort algorithm. All elements must be taken from keyboard.
34, 23, 11, 45, 57, 100, 52, 70, 89, 15, 77, 65.
Exp 2. Write a program in C to implement binary search algorithm.
Exp 5. Write a program in C to sort an array using bubble sort algorithm.
Exp 6. Write a program in C to sort an array using insertion sort algorithm.
Term 191¶
Exp 1. Write a C program to sort the following elements using Insertion sort algorithm. All elements must be taken from keyboard.
36, 92, 84, 25, 41, 68, 27, 54, 79, 66
Exp 2. Write a C program to sort the following elements using Bubble Sort algorithm. All elements must be taken from keyboard.
36, 92, 84, 25, 41, 68, 27, 54, 79, 66
Exp 6. Write a C program to sort the following elements using Quick Sort algorithm. All elements must be taken from keyboard.
36, 92, 84, 25, 41, 68, 27, 54, 79, 66
Exp 8. Write a C program to implement binary search algorithm.
Exp 10. Write a C program to sort the following elements using Selection sort algorithm. All elements must be taken from keyboard.
44, 33, 11, 55, 77, 100, 42, 60, 99, 25, 88, 66.
Term 201¶
Exp 4. Write a program for binary search algorithm.
Exp 9. Write a program to implement hashing technique.
Term 211¶
Exp 2. Write a program in C to sort the following elements using Quick Sort algorithm. All elements must be taken from keyboard.
34, 23, 11, 57, 1, 52, 7, 89, 15, 77, 65.
Common Assessment Components¶
Every supplied paper includes:
- A. Choose and perform one experiment by lottery from out of the listed experiments. 1 x 40 = 40
- B. Notebook on experiments. 10
- C. Viva-voce. 10