Describe how to find an element in a binary search tree. You may use English sentences or pseudocode.

What will be an ideal response?


Let x be the element that is being searched for. The algorithm begins by checking to see if the root is equal to
x. If it is, it halts, returning a reference to the element at the root. Otherwise it compares x to the root. If the root is not a leaf
and x is larger, then it recursively calls the method on the right subtree, and if it is smaller, it recursively calls the method on the
left subtree. If the node is a leaf, it returns null, meaning that the item is not found.

Computer Science & Information Technology

You might also like to view...

What is the distinction between the virtualization approach advocated by Xen and the style of microkernel advocated by the Exokernel project? In your answer, highlight two things they have in common and two distinguishing characteristics between the approaches.

What will be an ideal response?

Computer Science & Information Technology

______________ is a graphical language that allows people who design software systems to use an industry-standard notation to represent them.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

In a for statement, the last action to take place is that ____.

A. the update statement is executed B. the for loop condition is evaluated C. the counter variable is initialized D. the statements execute

Computer Science & Information Technology

Communication modules are referred to as ____________________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology