Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

One way to look at what is going on here is to think of the sorted array as already being in the form of a binary search tree, where each mid-point is the top node of a sub-tree.    All the above algorithm is doing is walking down from the top of the binary search tree, i.e the path 12 => 7 => 10 => 11.

No Format
                    12
                /        \
             7               25
          / /    \         /     \
        2         10     13        28
      /  \          \       \     /  \
     1    4          11       20  27   30

===================================================================================================================

...