bst-example.k 372 B

123456789101112131415161718192021222324252627282930313233
  1. \l bst.k
  2. \d tree
  3. \l trees.k
  4. \d .
  5. para:`0:
  6. drw:{(p;n):((<g)@;::)@'0^x[0 2]@\:g:gt.(0^x 0 1); tree.shw[$n;p]}
  7. dr:drw@[;1 2 2]@
  8. data:-15?50
  9. t:(e;!0;!0;!0)
  10. rs:t ins\data
  11. r:*|rs
  12. para"orig"
  13. dr r
  14. drw r[1 2],,!#r[1]
  15. drw r 1 2 3
  16. para"Insertion"
  17. dr@/:1_rs;
  18. para""
  19. para"Indices"
  20. drw r[1 2],,!#r[1]
  21. para""
  22. para"Height"
  23. drw r[1 2 3]
  24. para""
  25. para"Delete middle index"
  26. dr del[r;1]