# TikZ computer science examples

> Computer science figures in TikZ with code: binary search and red–black trees, a heap, linked lists, max flow, IEEE 754, a Git workflow and containers.

URL: https://www.labcanvas.com/tikz/examples/computer-science

Twelve figures: four data structures (a binary search tree, a red–black tree, a binary heap and a singly linked list), three algorithms (the Burrows–Wheeler transform, a maximum flow problem and a shortest path in a weighted graph) and five systems diagrams (the fetch–decode–execute cycle, a Git workflow, the bit layout of an IEEE 754 floating-point number, a system block diagram, and virtual machines compared with containers).

The trees and lists show how TikZ handles linked structures: nodes placed with `positioning` or the tree syntax, multi-part nodes from `shapes.multipart` for list cells, and edges between named nodes.

## Data structures

- **Binary search tree** (Data structures): MIT licence, © Martin Thoma. Source: https://github.com/MartinThoma/LaTeX-examples/blob/f9236c5fe5d47f19822fcb11097df27355562314/tikz/binary-search-tree/binary-search-tree.tex. Code: https://www.labcanvas.com/tikz-library/code/binary-search-tree.tex
- **Red–black tree** (Data structures): MIT licence, © Martin Thoma. Source: https://github.com/MartinThoma/LaTeX-examples/blob/f9236c5fe5d47f19822fcb11097df27355562314/tikz/red-black-tree/red-black-tree.tex. Code: https://www.labcanvas.com/tikz-library/code/red-black-tree.tex
- **Binary heap** (Data structures): MIT licence, © Martin Thoma. Source: https://github.com/MartinThoma/LaTeX-examples/blob/f9236c5fe5d47f19822fcb11097df27355562314/tikz/heap/heap.tex. Code: https://www.labcanvas.com/tikz-library/code/binary-heap.tex
- **Singly linked list** (Data structures): MIT licence, © Martin Thoma. Source: https://github.com/MartinThoma/LaTeX-examples/blob/f9236c5fe5d47f19822fcb11097df27355562314/tikz/singly-linked-list/singly-linked-list.tex. Code: https://www.labcanvas.com/tikz-library/code/singly-linked-list.tex

## Algorithms

- **Burrows–Wheeler transform** (Algorithms): MIT licence, © Petar Veličković. Source: https://github.com/PetarV-/TikZ/blob/86aee049f5355d77c598b936399e42caf8941e60/BWT/bwt.tex. Code: https://www.labcanvas.com/tikz-library/code/burrows-wheeler-transform.tex
- **Maximum flow problem** (Algorithms): MIT licence, © Petar Veličković. Source: https://github.com/PetarV-/TikZ/blob/86aee049f5355d77c598b936399e42caf8941e60/Maximum%20flow%20problem/maximum_flow_problem.tex. Code: https://www.labcanvas.com/tikz-library/code/maximum-flow-problem.tex
- **Shortest path in a weighted graph** (Algorithms): MIT licence, © Petar Veličković. Source: https://github.com/PetarV-/TikZ/blob/86aee049f5355d77c598b936399e42caf8941e60/Shortest%20path%20problem/shortest_path_problem.tex. Code: https://www.labcanvas.com/tikz-library/code/shortest-path-in-a-weighted-graph.tex

## Systems & architecture

- **Fetch–decode–execute cycle** (Systems & architecture): MIT licence, © Petar Veličković. Source: https://github.com/PetarV-/TikZ/blob/86aee049f5355d77c598b936399e42caf8941e60/Fetch-decode-execute%20cycle/fetch-decode-execute_cycle.tex. Code: https://www.labcanvas.com/tikz-library/code/fetch-decode-execute-cycle.tex
- **Git workflow** (Systems & architecture): MIT licence, © Petar Veličković. Source: https://github.com/PetarV-/TikZ/blob/86aee049f5355d77c598b936399e42caf8941e60/git%20workflow/git_workflow.tex. Code: https://www.labcanvas.com/tikz-library/code/git-workflow.tex
- **IEEE 754 floating-point number** (Systems & architecture): MIT licence, © Martin Thoma. Source: https://github.com/MartinThoma/LaTeX-examples/blob/f9236c5fe5d47f19822fcb11097df27355562314/tikz/ieee-754-float/ieee-754-float.tex. Code: https://www.labcanvas.com/tikz-library/code/ieee-754-floating-point-number.tex
- **System block diagram** (Systems & architecture): CC0 1.0, OpenTikZ contributors. Source: https://github.com/opentikz/opentikz/blob/359befbf8e8af7ce08e7e387b2c2a198e0ca735d/templates/system-block-diagram/template.tex. Code: https://www.labcanvas.com/tikz-library/code/system-block-diagram.tex
- **Virtual machines vs containers** (Systems & architecture): MIT licence, © Andreas Bauer. Source: https://github.com/andreas-bauer/tikz/blob/f17e1dc749c2b7981f54ee7e696a73273d6771b6/vm-vs-container.tex. Code: https://www.labcanvas.com/tikz-library/code/virtual-machines-vs-containers.tex

## Using these figures

Every figure keeps its own licence: MIT or CC0 1.0, both of which allow use, change and sharing, commercial use included. The MIT licence asks that its copyright and permission notice go with copies of the code, so each figure’s code starts with its source, author and licence; keep those lines when you reuse it. The full licence texts are on the [sources and licences page](https://www.labcanvas.com/tikz-library/credits.html).

“Open in the TikZ editor” loads the figure’s complete document into the free TikZ editor, where it is typeset with TeX Live 2026 and you can change it and download a PNG. To compile it on your own computer, save the code as a.tex file and run pdfLaTeX (or the engine the tile names) on it; LabCanvas changed the files only where needed to make each one compile on its own, as its first lines say.

Licence texts: https://www.labcanvas.com/tikz-library/credits.html
