###### Waste less time on Facebook — follow Brilliant.
×
Back to all chapters

# Trees

Whether you're working with a road map or just some numerical data, organizing data in trees allows for an efficient representation of connections and hierarchies.

# Binary Search Trees

Suppose the keys 55,63,31,17,22,40 are inserted into a binary tree in that order. Which of the following is the BST that is formed?

A:

B:

C:

D:

Given a binary search tree, we want to write a search method. This method will look for a node with a specific key and return that node. Below is an incomplete implementation

The two redboxes indicate missing code. What lines should replace box 1 and box 2 respectively?

Which of the insertion sequences cannot produce the binary search tree below?

BST

×