0% found this document useful (0 votes)
386 views

Advanced Data Structure IT-411

This document outlines experiments for an Advanced Data Structures lab manual. It includes 8 experiments covering topics like arrays, linked lists, stacks, queues, trees, sorting, searching, hashing, heaps and disjoint sets. Each experiment contains multiple programming problems to implement various data structures and algorithms. Instructions are provided for tasks like generating binary trees from traversals, implementing different sorting and searching algorithms, and using data structures like B-Trees, binomial heaps and disjoint sets to solve graph problems. Students are expected to write code for the problems, test them, and submit working programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
386 views

Advanced Data Structure IT-411

This document outlines experiments for an Advanced Data Structures lab manual. It includes 8 experiments covering topics like arrays, linked lists, stacks, queues, trees, sorting, searching, hashing, heaps and disjoint sets. Each experiment contains multiple programming problems to implement various data structures and algorithms. Instructions are provided for tasks like generating binary trees from traversals, implementing different sorting and searching algorithms, and using data structures like B-Trees, binomial heaps and disjoint sets to solve graph problems. Students are expected to write code for the problems, test them, and submit working programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lab Manual

Advanced Data Structures (Pr): IT-411

Lab Instructions
Whether an experiment contains one or
several practicals /programs

Several
practicals / programs

Lab Teacher forms groups of the students based on

One
practical / program
All Students need to perform the
practical/program

Assign all practicals /programs among all groups

Teacher decides whether the completed practicals / programs can be appropriately described
using flow chart, algorithm, query statement, etc.
Teacher issues necessary instructions to the students for writing practicals / programs
accordingly

Students write experiments in practical files and get them signed by the lab teacher
Students make entries in the list of contents of the practical files and get them signed by
the lab teacher

Whether practical has been verified


and signed by the lab teacher?

If a student has not completed a practical, he/she is expected to complete it at his/her


own with the help of his/her fellow students in his/her hostel
The student completes the practical file and submits it to the concerned teacher in
his/her office or mail box on next working day

In case of an experiment containing several practicals, a lab teacher needs to think whether a
practical performed by the students in one group needs to be repeated by the other groups in lab on
the same day?
OR
A practical performed by the students in one group needs to be repeated as assignments to be
completed by the students of other groups in their hostels? Here, an assignment includes both
executing a program on computer and also writing the same in practical file.
OR
A practical performed by the students in one group needs to be repeated as assignments, only
writing practicals in their practical files, for the students of other groups in their hostels?
Teacher issues necessary instructions to the students accordingly.

Lab Manual
Advanced Data Structures (Pr)
IT-411
L T P
- - 3

Practical exam: 40
Sessional: 60

Note: To represent tree in the following programs, use set notations, e.g. The following tree in
below figure can be represent as ((D)B(E))A((F)C). Again if node D got right child F then it
is display as ((D(F))B(E))A((F)C).

Also output the inorder traversal of the resultant trees. The set representation is used to avoid the
difficulty of printing pictorial representation.
Experiment 1 (Arrays, Linked List, Stacks, Queues, Binary Trees )
I.

II.

III.
IV.
V.
VI.

WAP to implement a 3-stacks of size m in an array of size n with all the basic
operations such as IsEmpty(i), Push(i), Pop(i), IsFull(i) where i denotes the stack
number (1,2,3), m n/3. Stacks are not overlapping each other. Leftmost stack facing
the left direction and other two stacks are facing in the right direction.
WAP to implement 2 overlapping queues in an array of size N. There are facing in
opposite direction to eachother. Give IsEmpty(i), Insert(i), Delete(i) and IsFull(i)
routines for ith queue
WAP to implement Stack ADT using Linked list with the basic operations as Create(), Is
Empty(), Push(), Pop(), IsFull() with appropriate prototype to a functions.
WAP to implement Queue ADT using Linked list with the basic functions of Create(),
IsEmpty(), Insert(), Delete() and IsFull() with suitable prototype to a functions
WAP to generate the binary tree from the given inorder and postorder traversal.
WAP to generate the binary tree from the given inorder and preorder traversals.

Experiment 2 (Sorting & Searching Techniques)


I.

II.

III.

IV.

V.

VI.

WAP to implement Quick Sort on 1D array of Student structure (contains student_name,


student_roll_no, total_marks), with key as student_roll_no. And count the number of
swap performed.
WAP to implement Merge Sort on 1D array of Student structure (contains
student_name, student_roll_no, total_marks), with key as student_roll_no. And count the
number of swap performed.
WAP to implement Bubble Sort on 1D array of Employee structure (contains
employee_name, emp_no, emp_salary), with key as emp_no. And count the number of
swap performed.
WAP to implement Binary search on 1D array of Employee structure (contains
employee_name, emp_no, emp_salary), with key as emp_no. And count the number of
comparison happened.
WAP to implement Bucket Sort on 1D array of Faculty structure (contains
faculty_name, faculty_ID, subject_codes, class_names), with key as faculty_ID. And
count the number of swap performed
WAP to implement Radix Sort on 1D array of Faculty structure (contains faculty_name,
faculty_ID, subject_codes, class_names), with key as faculty_ID. And count the number
of swap performed.
Experiment 3 (Hashing)

I.

WAP to store k keys into an array of size n at the location computed using a hash
function, loc = key % n, where k<=n and k takes values from [1 to m], m>n. To handle
the collisions use the following collision resolution techniques,
a. Linear probing
b. Quadratic probing
c. Random probing
d. Double hashing/rehashing
e. Chaining

II.
III.
IV.
V.

Implement the above program I using hash function from Division methods.
Implement the above program I using hash function from Truncation methods.
Implement the above program I using hash function from Folding methods.
Implement the above program I using hash function from Digit analysis methods.

Experiment 4 (BST and Threaded Trees)


I.

II.
III.
IV.
V.
VII
VIII.

WAP for Binary Search Tree to implement following operations:


a. Insertion
b. Deletion
i. Delete node with only child
ii. Delete node with both children
c. Finding an element
d. Finding Min element
e. Finding Max element
f. Left child of the given node
g. Right child of the given node
h. Finding the number of nodes, leaves nodes, full nodes, ancestors,
descendants.
WAP to implement Inorder Threaded Binary Tree with insertion and deletion operation.
WAP to implement Preorder Threaded Binary Tree with insertion and deletion
operation.
WAP to implement Postorder Threaded Binary Tree with insertion and deletion
operation.
WAP to traverse given Inorder Threaded Binary Tree in inorder, preorder and postorder
fashion.
WAP to traverse given Postorder Threaded Binary Tree in inorder, preorder and
postorder fashion.
WAP to transform BST into Threaded Binary Tree.
Experiment 5 (AVL Trees and Red-Black Trees)

I.

II.
III.
IV.
V.
VI.

WAP for AVL Tree to implement following operations: (For nodes as integers)
a. Insertion: Test program for all cases (LL, RR, RL, LR rotation)
b. Deletion: Test Program for all cases (R0, R1, R-1, L0, L1, L-1)
c. Display: using set notation.
Implement the above program I for nodes as Student structure, with key as Student_
roll_no.
WAP to implement Red-Black trees with insertion and deletion operation for the given
input data as Strings
Implement the above program III for nodes as Employee structure, with key as
emp_no.
WAP using function which computes the balance factor of any given node in a BST.
WAP to transform BST into AVL trees and also count the number rotations
performed.
3

VII.
VIII.
IX.

WAP to find whether the given BST is AVL tree or not.


WAP to convert BST into Red-Black trees.
WAP to find the black height of any given node in Red-Black tree and find the black
height of the Red-Balck tree.
Experiment 6 ( B-Trees)

I.

II.

III.

IV.

V.

WAP to implement insertion, deletion, display and search operation in m-way B tree
(i.e. a non-leaf node can have atmost m children) for the given data as integers (Test
the program for m=3, 5, 7).
WAP to implement insertion, deletion, display and search operation in m-way B tree
(i.e. a non-leaf node can have atmost m children) for the given data as strings (Test the
program for m=3, 5, 7).
WAP to implement insertion, deletion, display and search operation in m-way B tree
(i.e. a non-leaf node can have atmost m children) for the given data as Student
structures (as given above), with key as student_ roll_no . (Test the program for m=3,
5, 7).
WAP to implement insertion, deletion, display and search operation in m-way B tree
(i.e. a non-leaf node can have atmost m children) for the given data as Employee
structures (as given above), with key as emp_no. (Test the program for m=3, 5, 7).
WAP to implement insertion, deletion, display and search operation in m-way B tree
(i.e. a non-leaf node can have atmost m children) for the given data as Faculty
structures (as given above), with key as faculty_ID. (Test the program for m=3, 5, 7).
Experiment 7 (Min-Max Heaps, Binomial Heaps and Fibonacci Heaps )

I.
II.

III.

IV.
V.
VI.

WAP to implement insertion, deletion and display operation in Min-Max Heap for the
given data as integers.
WAP to implement Make_Heap, Insertion, Find_Min, Extract_Min, Union,
Decrease_Key and Delete_Key operations in Binomial Heap for the given data as
strings.
WAP to implement Make_Heap, Insertion, Find_Min, Extract_Min, Union,
Decrease_Key and Delete_Key operations in Fibonacci Heap for the given data as
Student structures (contains student_name, student_roll_no, total_marks), with key as
student_ roll_no.
Implement the above program (I) of Min-Max heap for Employee structures (contains
employee_name, emp_no, emp_salary), with key as emp_no.
Implement the above program (II) of Binomial Heap for Faculty structures (contains
faculty_name, faculty_ID, subject_codes, class_names), with key as faculty_ID.
Implement the above program (III) of Fibonacci Heap for strings.
4

Experiment 8 (Disjoint Sets)


I.

II.

III.
IV.

WAP to implement Make_Set, Find_Set and Union functions for Disjoint Set Data
Structure for a given undirected graph G(V,E) using the linked list representation with
simple implementation of Union operation.
WAP to implement Make_Set, Find_Set and Union functions for Disjoint Set Data
Structure for a given undirected graph G(V,E) using the linked list representation with
weighted-union heuristic approach..
WAP to implement Make_Set, Find_Set and Union functions using Union by rank
heuristic for Disjoint Set forest rooted trees representation.
WAP to implement Make_Set, Find_Set and Union functions using Path compression
heuristic for Disjoint Set forest rooted trees representation.
Experiment 9 (Graphs Algorithms)

I.

WAP to perform topological sort on dag using depth first search.

II.

WAP to generate minimum spanning tree in a connected, undirected weighted graph


using Kuruskals algorithm with disjoint set data structures.
WAP to generate minimum spanning tree in a connected, undirected weighted graph
using Primss algorithm with disjoint set data structures.
WAP to find single-source shortest path in a weighted directed graph using BellmanFord algorithm
WAP to find single-source shortest path in a weighted dag using topological sort.
WAP to implement Dijkstras algorithm for single-source shortest path in a weighted
directed graph using fibonacci heap.
WAP to find all-pairs shortest path using dynamic-programming algorithm based on
matrix multiplication.
WAP to find all-pairs shortest path using Floyd-Warshall algorithm.
WAP to find all-pairs shortest path using Johnsons algorithm for sparse graphs.

III.
IV.
V.
VI.
VIII.
IX
X.
XI
XII.

WAP to print strongly connected components in a directed graph.


WAP to find articulation points, bridges, and biconnected components usnig depthfirst search in a connected, undirected graph.
Experiment 10 (String Matching)

I.
II.
III.
IV.
V.

WAP to perform string matching using naive algorithm


WAP to perform string matching using Rabin-Karp algorithm.
WAP to perform string matching using Finite Automata.
WAP to perform string matching using Knuth-Morris-Pratt algorithm.
WAP to perform string matching using Boyer-Moore algorithm.
5

You might also like