Skip to content

Instantly share code, notes, and snippets.

@jeffomatic
Created August 22, 2012 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffomatic/3421916 to your computer and use it in GitHub Desktop.
Save jeffomatic/3421916 to your computer and use it in GitHub Desktop.
Binary tree output 1
values: [3, 9, 8, 5, 5, 0, 6, 3, 4, 4, 5, 0, 8, 3, 2, 7, 8, 3, 6,
4, 3, 7, 8, 4, 1, 5, 1, 5, 5, 0, 3, 5, 8, 8, 7, 0, 4, 5, 1, 0, 2,
7, 7, 2, 2, 9, 6, 2, 2, 0, 9, 9, 0, 2, 7, 8, 5, 2, 4, 1, 6, 1, 3,
9, 7]
⌜··················3·······································⌝
⌜0·⌝ ⌜······9·⌝
0 ⌜0········⌝ ⌜···················8·⌝ ⌜9⌝
0 ⌜···2·⌝ ⌜··········5·⌝ ⌜8·⌝ 9 9⌝
⌜1·⌝ ⌜2·⌝ ⌜3····⌝ ⌜5·······⌝ 8 ⌜8⌝ 9
⌜·1 ⌜1⌝ 2 ⌜2·⌝ 3 ⌜··4·⌝ 5 ⌜6···⌝ 8 8⌝
⌜0⌝ 1 1 2 ⌜2⌝ ⌜3⌝ ⌜4·⌝ ⌜····6 ⌜7·⌝ 8
0 0 2 2 3 3⌝ 4 ⌜4⌝ ⌜5·⌝ ⌜·7 ⌜7·⌝
3 4 4 5 ⌜5⌝ 6⌝ 7 ⌜7⌝
5 5⌝ 6 7 7
5
sorted: [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9,
9, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment