Professional Documents
Culture Documents
Assignment 4444 DS
Assignment 4444 DS
ASSIGNMENT# 04
Submitted To:
SIR IMRAN
Submitted By:
NOREEN JAMIL
SP22-BCS-169
Sahiwal Campus
Question 1: You are tasked with designing a program that manages a directory of
employees using a Binary Search Tree (BST). Each employee record has the following
attributes: Employee ID, Name, and Position. The program needs to support insertion,
deletion, searching, and in-order traversal operations.
Tasks:
Insertion:
Implement a function to insert a new employee record into the BST. The
employee records are sorted based on their Employee ID.
Deletion:
Searching:
In-order Traversal:
Create a class or struct to represent an employee record with the following attributes:
o Employee ID (int or string): Unique identifier for each employee.
o Name (string): Employee's full name.
o Position (string): Employee's job title or position.
3. Implement Insertion:
4. Implement Deletion:
5. Implement Searching:
Function: inorderTraversal(root)
Logic:
o Recursively traverse the tree in in-order fashion:
Traverse the left subtree.
Print the current node's employee details.
Traverse the right subtree.
7. Main Program:
Remember:
Thoroughly test your code with various employee records and BST operations.
Consider handling edge cases and potential errors.
Pay attention to BST properties (left child's ID < parent's ID < right child's ID) during
insertion and deletion.
CODE:
Output of this code