0% found this document useful (0 votes)
10 views2 pages

BTCCBSTWorkheet

The document is a worksheet focused on constructing and manipulating Binary Search Trees (BSTs) using various sets of integers and words. It includes tasks such as inserting and deleting nodes, performing different tree traversals, and analyzing the structure of BSTs. Additionally, it poses questions regarding the validity of BSTs and the sequences of keys examined during searches.

Uploaded by

divinephoenix65
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

BTCCBSTWorkheet

The document is a worksheet focused on constructing and manipulating Binary Search Trees (BSTs) using various sets of integers and words. It includes tasks such as inserting and deleting nodes, performing different tree traversals, and analyzing the structure of BSTs. Additionally, it poses questions regarding the validity of BSTs and the sequences of keys examined during searches.

Uploaded by

divinephoenix65
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Binary Search Tree Worksheet

1. Construct a Binary Search Tree (BST) with the following elements:


 50, 30, 70, 20, 40, 60, 80
 Draw the tree and write its Inorder, Preorder, and Postorder traversals.
2. Insert the following values into a BST: 15, 10, 25, 30, 5, 20.
 Show the final tree structure.
 Perform Inorder, Preorder, and Postorder traversals.
3. Given a BST with elements {45, 20, 50, 15, 25, 60, 55}, perform:
 Insertion of value 35.
 Deletion of value 20.
 Display the tree structure before and after modifications.
4. Create a BST using the words: "apple", "banana", "cherry", "date", "fig", "grape".
 Store them in alphabetical order.
 Perform Inorder traversal.
5. Construct a BST using student roll numbers: 102, 98, 150, 120, 85, 110.
 Show the BST structure.
 Find and print the smallest and largest roll numbers.
6. Insert elements {90, 70, 50, 80, 110, 100, 120} into a BST.
 Display the BST.
 Perform all three traversals.
 Find the height of the tree.
7. Given the BST below, perform a deletion operation:
30
/ \
20 40
/ \ \
10 25 50
 Delete node 30 and show the updated BST.
 Perform Inorder traversal after deletion.

8. Starting from an empty binary search tree, create the binary search tree with the letters: P,
R, I, N, C, E, T, O, N
a. What keys are examined when we search for E?
b. What keys are examined when we search for Q?

9. Which of the following is not a valid binary search tree? Of the valid ones, which is fastest
to search?

10. Suppose we have integer values between 1 and 1000 in a BST and search for 363. Which
of the following cannot be the sequence of keys examined?
a. 2, 252, 401, 398, 330, 363
b. 399, 387, 219, 266, 382, 381, 278, 363
c. 3, 923, 220, 911, 244, 898, 258, 362, 363
d. 4, 924, 278, 347, 621, 299, 392, 358, 363

You might also like