Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Binary Search Trees theory question?

1. ## Binary Search Trees theory question?

Suppose that a certain BST has keys that are integers between 1 and 10, and we search for 5. Which sequence below cannot be the sequence of keys examined?

(a) 10,9,8,7,6,5
(b) 4,10, 8, 6, 5
(c)1,10,2,9,3,8,4,7,6,5
(d) 2,7,3,8,4,5
(e)1,2,10,4,8,5

I've noticed many differences, such as there is only one with an odd number of keys, and one has all integers from 1-10 inside of it, but I can't find any real reason that you wouldn't be able to search it?
Does anyone know any tips for this?

2. ## Re: Binary Search Trees theory question?

There are specific rules that determine the construct of a binary search tree. Look up those rules and then review the question's possible answers to see if they comply with the rules.

3. ## Re: Binary Search Trees theory question?

These answers are not in any particular order, so couldn't they ALL be binary search trees, once correctly put into a BST?