Jump to content

User:Brona/Images/binomial heap.tex

From Wikipedia, the free encyclopedia
%Example of binomial heap.
%
%latex binomial_heap; dvips binomial_heap
%open .ps file in gimp, choose strong antialias in both text and graphics,
%resulution 200, greyscale mode, crop, blur by 1, scale to 50%, save as .png
%
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{pst-node}
%
\def\NODE(#1,#2)#3{\cnode(#1,#2){.35cm}{#3}\rput(#1,#2){#3}}
\def\ya{3.6}\def\yb{2.4}\def\yc{1.2}\def\yd{0}
%
\begin{document}
%
\begin{pspicture}(0,0)(10,10)
%tree of order 0
\NODE(0,\ya){13}
%
%tree of order 2
\NODE(2,\ya){1}
\NODE(1,\yb){2}
\NODE(2,\yb){9}
\NODE(1,\yc){10}
%
\ncline{1}{2}
\ncline{1}{9}
\ncline{2}{10}
%
%tree of order 3
\NODE(6,\ya){3}
\NODE(4,\yb){4}
\NODE(5,\yb){11}
\NODE(6,\yb){6}
\NODE(3,\yc){5}
\NODE(4,\yc){8}
\NODE(5,\yc){12}
\NODE(3,\yd){7}
%
\ncline{3}{4}
\ncline{3}{11}
\ncline{3}{6}
\ncline{4}{5}
\ncline{4}{8}
\ncline{11}{12}
\ncline{5}{7}
%
\end{pspicture}
%
\end{document}