ds
ds
Laboratory Record
STUDENT NAME:
REGISTERED
NUMBER:
ACADEMIC YEAR:
BRANCH& YEAR:
SEMESTER:
SECTION:
COURSE
INSTRUCTOR:
S.No. Date Experiment Name Pre- In-Lab Post- Viva Total Faculty
Lab Lab Voce (10M) Signature
(1M) (1M) (1M)
Logic Exec Result Analysis
(2M) (2M) (2M) (1M)
For Evaluator’s use only
Marks Secured: _______ out of ________ Signature of the Evaluator Date of Evaluation Signature of the Head of the Department
2023-2024
VR20 Registration No.
Lab Session-1
Date Time of the Session: to
Pre Lab:
1. Write an algorithm for reading a string from the keyboard and count number of vowels in
the given string.
2. Write an algorithm to read n integer values through keyboard, find the middle element in
the given list. Also find the smallest element in the list from the starting to middle
position and find the big element from the mid+1 location to ending of the list.
In Lab:
1. If you have the attendance statement of an examination in an array, read student roll
number from the keyboard as an integer, find the student attended for the exam or not
using linear search.(assume the statement contains roll numbers in random)
Test Case:
2. Assume result is an array contains list of student roll numbers those who clear or pass the
Data structures course in the ascending order. Read the student roll number as an integer
and check the result of the student whether he/she pass or fail using binary search
technique.
Test Case:
Post Lab:
Lab Session-2
Date Time of the Session : to
Pre Lab:
Input:
Number of elements: 10
Dataset: 30, 70, 20, 90, 34, 12, 32, 54, 71, 89
In Lab
1. Develop a program to implement Merge Sort technique (Divide and conquer method)
Input:
Number of elements: 10
Dataset: 315, 219, 2, 678, 153, 248, 332, 464, 540, 49
2. Develop a program to implement Quick sort technique (Divide and conquer method)
Input:
Number of elements: 10
Dataset: 5, 9, 2, 7, 3, 8, 1, 6, 0, 4
Post Lab:
Lab Session-3
Date Time of the Session : to
Pre Lab:
In Lab:
Test Case:
Case 1: Initial Stack is empty, if you are trying to perform POP Operation
Output: Stack Underflow
Case 2: If your stack contains three elements, you are trying to perform PUSH
Operation.
Output: Top is updated by one and new element is inserted…
Case 3: If your stack contains four elements, you are trying to perform POP
Operation.
Output: Top reduced by one and top element is deleted from the stack
Post Lab:
a. After Completion of the following Stack Operations what are the element on the stack
(assume stack size is five)
PUSH (Stack, ’V’)
PUSH (Stack, ’R’)
PUSH (Stack, ’S’)
PUSH (Stack, ’E’)
PUSH (Stack, ’C’)
POP (Stack)
POP (Stack)
POP (Stack)
PUSH (Stack, ’C’)
PUSH (Stack, ’E’) Initially stack is empty
PUSH (Stack, ’S’)
b. If your stack is empty, you are trying to delete an element from the stack what happened?
c. If your stack is full, you are trying to perform PUSH() operation then what happened?
Lab Session-4
Date Time of the Session : to
Pre Lab:
3. Define recursion.
In Lab:
Test case:
Input : a + b
Output: a b +
Input : a – b * c
Output: a b c * -
Input : 9 2 3 * -
Output: 3
Post Lab:
a. Write the postfix expression for the following infix expression
a. a+b*c/d-e+f
b. a*(b-c*d)+(e/f)-g
ii. AB–C*D+
A=4 B=2 C=6 D=3
Lab Session-5
Date Time of the Session : to
Pre Lab:
a. Define Queue
In Lab:
Case 1: Initial Queue is empty, if you are trying to perform Enqueu Operation
Output: front and rear pointers\variables updated by one
Case 2: If your Queue contains three elements, you are trying to perform
Enqueue Operation.
Output: Rear position is updated by one and new element is inserted…
Case 3: If your Queue contains four elements, you are trying to perform
Dequeue Operation.
Output: Front reduced by one and one element is deleted from the Queue
Post Lab:
a. Compare Stacks and Queues
c. After Completion of the following Queue Operations what are the element on the Queue
(Assume queue size is 10)
Lab Session-6
Date Time of the Session : _to
Pre Lab:
In Lab:
Case 1: If your Circular Queue contains four (index 1 to index 5) elements, you
are trying to perform Enqueue Operation.
Output: Update rear position to index 0 and new element is inserted…
Case 2: If your Queue contains four elements, you are trying to perform
Dequeue Operation.
Output: Update front position and one element is deleted from the Queue
Post Lab:
a. If circular queue implemented using an arrays, size of the circular queue is MAX_SIZE.
Write the conditions for circular queue getting full and empty?
b. A data structure in which elements can be inserted or deleted at/from both the
ends butnot in the middle is?
Lab Session- 7
Date Time of the Session : _to
Pre Lab:
3. Define Structure variable with the name college and the structure members are
department name, department code and number of students in each department. Define
one structure type (and Pointer) variable to read and write the structure members.
In Lab:
Develop a Program to implement Singly Linked Operations
a) Insertion at the end b) Delete at the end c) Display the list elements
Head
2024 10
Head
2024 10 20
Head
2024 10 20 30
Head
2024 10
6. Delete a node from the end of the list
Head
NULL
List is empty
Post Lab:
a. What are the advantages and disadvantages of linked list?
b. What is the time complexity for inserting an element into the Singly linked list (end
of the list)?
c. Write a code for inserting an element into the Singly linked list at the specific
location.
Lab Session-8
Date Time of the Session : _to
Program Title: Implement Stack and Queue Operations using Linked List
Pre Lab:
1. Develop a function to insert an element in the Singly linked list at the beginning
position.
2. Develop a function to delete an element from the Singly linked list. (from beginning
position)
In Lab:
Develop a Program to implement Stack Operations using Linked List
Test Case:
Head
3024 30 20 10
Head
4024 40 30 20 10
Head
5024 50 40 30 20 10
3. Print Top element in the stack
30 20 10
Head
3024
40 is deleted from the stack
Test Case:
Front Rear
1024 3024 10 20 30
Front Rear
1024 4024 10 20 30 40
Front Rear
1024 5024 10 20 30 40 50
Post Lab:
a. Write an algorithm to implement the stack operations using Queue.
Lab Session-9
Date Time of the Session : to
Pre Lab:
In Lab:
Develop a Program to implement Doubly Linked Operations
a) Insertion at the end b) Delete from the end c)Display the list elements
Test Case:
Head
NULL
1. Insert the new node (10) in the empty List
Head
1024 10
Head
1024 10 20 30
Head 10 20
1024
Head
1024
10
Post Lab:
a. What are the advantages of Doubly linked list compare with Singly linked list (show
withdiagrammatic form)?
b. Draw Singly and Doubly linked list for the following Operations
Insert(list, ‘A’)
Insert(list, ‘E’)
Insert(List,’I’)
Delete(List)
Insert(List,’O’)
Delete(List)
Insert(List,’U’)
c. What is the time complexity for finding the element in the Doubly linked list?
Lab Session - 10
Date of Time of the Session : _to
Pre Lab:
1. Write Tree terminology
3. Define Binary Search. What are the different ways we can traverse Binary Search Tree?
5. In a Full Binary Tree, how many nodes exists of a given height ’h’?
In Lab:
Develop a program to implement Binary Tree with following Operations
a. BST - Find, findmax, findmin, insert
b. BST- Delete, Inorder, Preorder, Postorder traversal
31 45
31 45
45
45 16 16
16 16
29 29
24
19
29 19 19
19
Post Lab:
a. You are going to delete a node from the Binary search tree, if the selected node has two
children’s what we need to do?
e. Construct a binary tree for the given In-order and Pre order traversal
In Order traversal: D B H E A I F J C G
Pre Order reversal: A B D E H C F I J G
Lab Session-11
Date Time of the Session: _to
Pre Lab:
2. Discuss the construction of a Min heap and how following operations are performed on a
Min heap
4. Construct Max heap and Min heap trees for the following data.
In-Lab
Input:
Number of elements: 10
Data: 15, 19, 2, 78, 53, 48, 32, 64, 40, 9
Post Lab
1. Describe each step while sorting the following numbers in ascending order using heap
sort.
Lab Session-12
Date Time of the Session: _to
CO-4 Apply different graph traversal algorithms and hashing techniques to solve problems.
Program Title: Graph Traversal algorithms: Depth First Search and Breadth First Search
Pre Lab:
In what order are the vertices visited for a depth-first search that starts at v0? In what order are
the vertices visited for a breadth-first search that starts at v0?
In Lab
Post Lab
a. Adjacency matrix:
b. Incidence matrix:
a. Adjacency matrix:
b. Incidence matrix: