PART 2
Understanding the Need to Sort and Search
Each level contains values that are less than the previous level, and the root con-
tains the maximum key value for the tree. In addition, in this particular case, the
lesser values appear on the left and the greater on the right (although this order
isn’t strictly enforced). The figure actually depicts a binary max heap. You can also
create a binary min heap in which the root contains the lowest key value and each
level builds to higher values, with the highest values appearing as part of the
leaves.
As previously noted, BST has some advantages over binary heap when used
to perform a search. The following list provides some of the highlights of these
advantages:
Do'stlaringiz bilan baham: |