Skip to content

Instantly share code, notes, and snippets.

@jeffomatic
Created August 22, 2012 03:09
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/3421950 to your computer and use it in GitHub Desktop.
Save jeffomatic/3421950 to your computer and use it in GitHub Desktop.
Binary tree output 2
values: [4, 5, 0, 6, 2, 9, 7, 4, 1, 3, 8, 8, 2, 2, 7, 6, 8, 0, 0,
6, 9, 9, 0, 9, 3, 5, 6, 6, 2, 4, 0, 0, 0, 8, 7, 7, 0, 8, 6, 7, 7,
1, 7, 4, 1, 5, 6, 0, 9, 4, 0, 8, 0, 1, 0, 2, 9, 1, 4, 3, 5, 3, 4,
0, 1]
⌜··························4······⌝
⌜0·················⌝ ⌜····5····⌝
0 ⌜·····2····⌝ ⌜4·⌝ ⌜6··················⌝
⌜·········1·⌝ ⌜··3·⌝ 4 ⌜4⌝ ⌜·6 ⌜···········9·⌝
⌜0·⌝ ⌜1·⌝ ⌜2⌝ ⌜3⌝ 4 4⌝ ⌜5⌝ ⌜7······⌝ ⌜9·⌝
0 ⌜0·⌝ 1 ⌜1⌝ 2 2⌝ 3 3 4 5 5 ⌜···7 ⌜8·⌝ 9 ⌜9⌝
0 ⌜0·⌝ 1 1 2 ⌜6·⌝ ⌜···8 ⌜8⌝ 9 9
0 ⌜0·⌝ 6 ⌜6⌝ ⌜7·⌝ 8 8⌝
0 ⌜0⌝ 6 6 7 ⌜7⌝ 8
0 0 7 7
sorted: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
9, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment