1
$\begingroup$

I was reading binary search and suddenly realized that it would be very difficult for a binary search tree to find the middle value and then split in two. Are these related at all?

$\endgroup$

closed as unclear what you're asking by D.W., David Richerby, Nicholas Mancuso, Juho, Rick Decker Nov 3 '14 at 3:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I don't understand this question (and I'm not the only one). What do you mean by “for a binary search tree to find the middle value”? A binary search tree is a data structure, it doesn't do things like finding and splitting. $\endgroup$ – Gilles Nov 3 '14 at 19:51
2
$\begingroup$

A balanced binary search tree describes the working of the binary search algorithm on a sorted list. The root should contain the middle element, the left subtree the left half, the right subtree the right half, and so on recursively. The tree also has to be balanced, that is, to reflect the fact that we chose the middle element as the root. In this sense, a binary search tree is a generalization of binary search on a sorted list.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.