Are the ones in bold right a Given a search key k and a node

Are the ones in bold right?

a.) Given a search key k and a node v of a binary search tree T, drag and drop the proper action to each condition occurring in the find(k) operation:

- If a search key k is less than the key stored at node v, then the search continues in the left subtree.

- If a search key k is equal to the key stored at node v, then the search terminates.

- If a search key k is greater than the key stored at node v, then the search continues in the right subtree.

Drag and drop the proper big Oh into each statement below about the running time of searching in a binary search tree T (each node with a distinct key) with height h:

Either O(h) or O(1).

- Time spent per node in the search is O(h).

- Searching a key on the binary tree with height h runs in O(1) time.

b.) An AVL tree has the height-balance property such that for each internal node v of a binary tree T, the heights of the children of v differ by at most 2 .

Can either be: 1, 2, 3, 4, 5

Solution

1) If a search key k is less than the key stored at node v, then the search continues in the left subtree.(True)

2) If a search key k is equal to the key stored at node v, then the search terminates.(True)

3) If a search key k is greater than the key stored at node v, then the search continues in the right subtree.(True)

4)- Time spent per node in the search is O(1).

- Searching a key on the binary tree with height h runs in O(h) time.

5)An AVL tree has the height-balance property such that for each internal node v of a binary tree T, the heights of the children of v differ by at -1,0,1

===========================================================================

Comment about my work

Are the ones in bold right? a.) Given a search key k and a node v of a binary search tree T, drag and drop the proper action to each condition occurring in the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site