Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree:
1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree: The letter next to each node (e.g., a, b) denotes the tree node, and the number inside each node is the key. 1.1 Correctness (10 points) Is this binary tree a valid binary search tree? In other words, does it satisfy the binary search tree property? If not, which node(s) violates the binary search tree property, and why? How would you modify the violating node(s) to make the binary tree a valid binary search tree? Hint: You will lose points if your answer includes tree nodes that do NOT violate the binary search tree property. Insertion (5 points) If we insert a node with key 18 into the binary search tree in Figure 1 (or the corrected version if you need to modify the tree node(s) in the first question), how would the binary search tree look like after the insertion? Please draw the binary search tree as in Figure 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started