Awesome Open Source
Awesome Open Source

Elementary Algorithms

Edition: 1.6180339887498949


This book introduces about elementary algorithms and data structure. It includes side-by-side comparison about purely functional realization and their imperative counterpart.


From 2020/12, I started re-writing this book. The PDF can be downloaded for preview (EN, ). The 1st edition in Chinese () was published in 2017. I recently switched my focus to the Mathematics of programming, the new book is also available in (github)

  • Preface
  • Chapter 0, List;
  • Chapter 1, Binary Search Tree;
  • Chapter 2, Insertion sort;
  • Chapter 3, Red-black tree;
  • Chapter 4, AVL tree;
  • Chapter 5, Radix tree, Trie and Prefix Tree;
  • Chapter 6, B-Trees;
  • Chapter 7, Binary Heaps;
  • Chapter 8, Selection sort;
  • Chapter 9, Binomial heap, Fibonacci heap, and pairing heap;
  • Chapter 10, Queue;
  • Chapter 11, Sequences;
  • Chapter 12, Divide and conquer sort;
  • Chapter 13, Search;
  • Appendix


To build the book in PDF format from the sources, you need the following software pre-installed.

  • TeXLive, The book is built with XeLaTeX, a Unicode friendly version of TeX;

Install TeXLive

In Debian/Ubuntu like Linux environment, do NOT install the TeXLive through apt-get. Go to TeXLive official site to download the setup script.

$ wget
$ unzip
$ cd install-tl
$ sudo ./install-tl -gui text -repository

In Windows, TeXLive provide a gui based installer, in Mac OS X, there's a MacTeX.

Install ImageMagick and Graphviz

$ sudo apt-get install imagemagick
$ sudo apt-get install graphviz

For Windows and Mac OS X installer, ImageMagick can be download through; Graphviz can be download from:


You need the GNU make tool, in Debian/Ubuntu like Linux, it can be installed through the apt-get command:

$ sudo apt-get install build-essential

In Windows, you can install the MSYS for it. In Mac OS X, please install the developer tool from this command line:

$ xcode-select --install

Build the book PDF

enter the folder contains the book TeX manuscript, run

$ make

This will generate algoxy-en.pdf and algoxy-zh-cn.pdf. If you only need the Chinese version for example, you can run make cn instead.

Other branches

The other two branches, zh-cn and jvm are deprecated. Please do NOT checkout/track them.


LIU Xinyu

[email protected]

``Cogito ergo sum''

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Algorithms (37,445
Tree (20,456
Haskell (20,366
Book (20,234
Tex (19,609
Functional Programming (10,968
Sort (7,178
Heap (3,062
Graphviz (2,043