binary-tree.tex 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{tikz}
  5. \usetikzlibrary{arrows,positioning, calc}
  6. \tikzstyle{vertex}=[draw,fill=black!15,circle,minimum size=20pt,inner sep=0pt]
  7. \begin{document}
  8. \begin{preview}
  9. \begin{tikzpicture}[very thick,level/.style={sibling distance=60mm/#1}]
  10. \node [vertex] (r){$17$}
  11. child {
  12. node [vertex] (a) {$19$}
  13. child {
  14. node [vertex] {$20$}
  15. child {
  16. node [vertex] {$-3$}
  17. child {node [vertex] {$17$}}
  18. child {node [vertex] {$5$}}
  19. }
  20. child {node [vertex] {$6$}}
  21. }
  22. child {
  23. node [vertex] {$3$}
  24. child {node [vertex] {$7$}}
  25. child {node [vertex] {$2$}}
  26. }
  27. }
  28. child {
  29. node [vertex] {$9$}
  30. child {
  31. node [vertex] {$8$}
  32. child {node [vertex] {$2$}}
  33. }
  34. child {
  35. node [vertex] {$11$}
  36. child {node [vertex] {$17$}}
  37. child {node [vertex] {$-4$}}
  38. }
  39. };
  40. \end{tikzpicture}
  41. \end{preview}
  42. \end{document}