You are on page 1of 1

The University of Lahore

Department of CS & IT
Data Structure and Algorithms (Lab)
Assignment# 3
Instructor Name: Miss Kashmala Pervaiz 15th December, 2023
Course Title: Object Oriented Programming
Course Code:
Deadline: 22nd December, 2023 Total Marks: 10
Student Name: University ID:

1. Write a function, swapSubtrees, that swaps all of the left and right subtrees of a binary tree. Add
this function to the class binaryTreeType and create a program to test this function.
2. Rewrite the definition of the function searchNode of the class Binary tree so that it uses a binary
search to search the node.
3. Construct an AVL tree having the following elements:
H, I, J, B, A, E, C, F, D, G, K, L.
Perform rotations and show the resultant balanced tree at each of the following step.
a. Insert H, I, J.
b. Insert B, A.
c. Insert E.
d. Insert C, F, D.
e. Insert G.
f. Insert K.
g. Insert L.

You might also like