Question: 2. (10 pts. Consider a general linked-structured binary search tree (BST) implementation for the sorted map ADT. (Note that general BST's may not satisfy the


2. (10 pts. Consider a general linked-structured binary search tree (BST) implementation for the sorted map ADT. (Note that general BST's may not satisfy the height-balance property.) Algorithm I provides the pseudocode for the constructor of a node in a BST. Algorithm 1 NoDek, v, left, right, parent) 1: new node 2: w.keyk 3: w.value tu 4: w.left + left 5: w.right k then else Statement # Operation Statement 1 { .left Statement 1 returnu Statement 6 w w .right Statement 8 utw Statement 9 Write down tight big-Oh characterizations of the worst-case running time and space complex- ity of the implementation of the FIND method Algorithm 2) as a function of the number of nodes n in the (general) BST. Time Space 2. (10 pts. Consider a general linked-structured binary search tree (BST) implementation for the sorted map ADT. (Note that general BST's may not satisfy the height-balance property.) Algorithm I provides the pseudocode for the constructor of a node in a BST. Algorithm 1 NoDek, v, left, right, parent) 1: new node 2: w.keyk 3: w.value tu 4: w.left + left 5: w.right k then else Statement # Operation Statement 1 { .left Statement 1 returnu Statement 6 w w .right Statement 8 utw Statement 9 Write down tight big-Oh characterizations of the worst-case running time and space complex- ity of the implementation of the FIND method Algorithm 2) as a function of the number of nodes n in the (general) BST. Time Space
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
