Question

. If 2,000 elements are inserted into a binary search tree using the traditional, naïve algorithm...

. If 2,000 elements are inserted into a binary search tree using the traditional, naïve algorithm what is the height of the tree (give the actual number, not the order) in:

  1. The worst case

  2. The best case

(Please explain not just answer)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The maximum number of edges from the root to any leaf node provides the height of the tree.

Total number of elements or nodes = 2000

Worst Case:

Height of the tree = n - 1 = 2000 - 1 = 1999

Explanation:

If the tree structure is a left-skewed binary tree. In the left-skewed binary tree, each and every node has one child only and this child is the left child.  The height of a left-skewed binary tree is maximum.

Best Case:

Height of the tree = log2(n) = Floor (log2(2000)) = Floor (l0.97) = 10

Explanation:

If each and every node in a binary tree has two children starting from the root node to the leaf node. This tree is a full binary tree or a complete binary tree. It has a minimum height.

Add a comment
Know the answer?
Add Answer to:
. If 2,000 elements are inserted into a binary search tree using the traditional, naïve algorithm...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT