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

Algorithm Assignment

This document contains instructions for a coding assignment on binary search trees (BSTs). Students are asked to implement a BST class with methods for insertion, deletion, searching, and traversal. They then need to build a BST by inserting elements and print the in-order traversal. Finally, they must discuss advantages of BSTs, provide examples of their use, explain self-balancing BSTs and one type, and identify a limitation of regular BSTs.

Uploaded by

Shoaib Ur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Algorithm Assignment

This document contains instructions for a coding assignment on binary search trees (BSTs). Students are asked to implement a BST class with methods for insertion, deletion, searching, and traversal. They then need to build a BST by inserting elements and print the in-order traversal. Finally, they must discuss advantages of BSTs, provide examples of their use, explain self-balancing BSTs and one type, and identify a limitation of regular BSTs.

Uploaded by

Shoaib Ur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Course Title: Game Development Course Code: CSC495 Credit Hours: 3

Course Instructor: Anam Khan Programme Name: Bachelor of Science in SE


Semester: 4th Batch: FA21 Section: C Sub Date: 2-05-223
Assignment No 4th Maximum Marks: 20
Student’s Name: Reg. No. CUI//SWL
Important Instructions / Guidelines:
1. Your answers should be well-structured and demonstrate a clear understanding of the topic.
2. Support your answers with relevant examples and explanations.
3. Make sure to cite any external sources used for reference (if applicable).

COMSATS University Islamabad


Sahiwal Campus (Computer Science)
Course Title: Data Structures and Algorithm Credit Hours: 3
Course Instructor: Anam Khan Programme Name: Bachelor of Science in S
Semester: 4th Batch: FA21 Section: A+B Sub Date: 2-05-223
Assignment No 4th Maximum Marks: 10
Student’s Name: Reg. No. CUI//SWL
Important Instructions / Guidelines:
1. Your answers should be clear, concise, and well-structured.
2. Code implementations should follow proper C++ syntax and conventions.

COMSATS University Islamabad


Sahiwal Campus (Computer Science)

Assignment Question
Implement a C++ program to create a Binary Search Tree class. The class should have the
following functionalities:
1. Insertion of elements into the BST.
2. Deletion of elements from the BST.
3. Searching for an element in the BST.
4. Traversal methods to visit all elements in the BST (preorder, inorder, and postorder).
5. A method to determine the height of the BST.
Build a Binary Search Tree by inserting the following elements into an empty BST: 25, 15, 50,
10, 22, 35, 70, 4, 12, 18, 24, 31, 44, 66, 90. Show the result using in-order traversing.
Discuss two advantages of using a Binary Search Tree compared to other data structures for
searching and sorting operations. Provide examples where a Binary Search Tree would be a
suitable choice over other alternatives.
Explain the concept of a self-balancing binary search tree. Discuss one type of self-balancing
Binary Search Tree and describe how it maintains balance during insertions and deletions.
Identify and discuss a potential limitation of binary search trees. Explain a scenario where this

You might also like