Drawing B Tree in Latex

Written by sathish. Posted in Linux

Latex is a Document Markup Language. It’s not an editor.

File Extension is .tex.  Latex is widely used in Schools and Colleges for the academic activities, like project report and so on. It was originally written by Leslie Lamport. Here we have given an example of creating Binary Tree in latex. For that  we have used ‘Tikz(Package name:pgf-2.00)’

Installing the Pacakge of Tikz(Package name:pgf-2.00)
  1. Extract the package.
  2. move pgf-2.00 to ‘/usr/share/texmf’ (Note we have used Texmaker in Fedora-13, hence we got texmf in share directory)
\begin{center}
\begin{tikzpicture}
 \node [circle,draw]{1} [level distance=10mm,sibling distance=25mm]
child { node [circle,draw]{6} [level distance=10mm ,sibling distance=15mm]
child {node [circle,draw] {8}
child {node [circle,draw] {12}}
child {node [circle,draw]{20}}}
child {node [circle,draw]{7}}
}
child {node [circle,draw] {4} [level distance=10mm ,sibling distance=15mm]
child {node [circle,draw] {9}}
child {node [circle,draw]{30}}
};
\end{tikzpicture}
\end{center}
Output of the above code: Example of  

Popular Posts

Techlister© - 2012