Advanced Data Structure IT-411
Advanced Data Structure IT-411
Lab Instructions
Whether an experiment contains one or
several practicals /programs
Several
practicals / programs
One
practical / program
All Students need to perform the
practical/program
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
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.
II.
III.
IV.
V.
VI.
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.
II.
III.
IV.
V.
VII
VIII.
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.
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
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.
II.
III.
IV.
V.
VI.
VIII.
IX
X.
XI
XII.
I.
II.
III.
IV.
V.