heap.tex 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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=18pt,inner sep=0pt]
  7. \begin{document}
  8. \begin{preview}
  9. \begin{tikzpicture}[very thick,level/.style={sibling distance=70mm/#1}]
  10. \node [vertex] (r){$-4$}
  11. child {
  12. node [vertex] (a) {$2$}
  13. child {
  14. node [vertex] {$5$}
  15. child {
  16. node [vertex] {$6$}
  17. child {node [vertex] {$20$}}
  18. }
  19. child {
  20. node [vertex] {$9$}
  21. }
  22. }
  23. child {
  24. node [vertex] {$3$}
  25. child {node [vertex] {$19$}}
  26. child {node [vertex] {$7$}}
  27. }
  28. }
  29. child {
  30. node [vertex] {$-3$}
  31. child {
  32. node [vertex] {$8$}
  33. child {node [vertex] {$17$}}
  34. child {node [vertex] {$17$}}
  35. }
  36. child {
  37. node [vertex] {$2$}
  38. child {node [vertex] {$11$}}
  39. child {node [vertex] {$17$}}
  40. }
  41. };
  42. \end{tikzpicture}
  43. \end{preview}
  44. \end{document}