Skip to content


Learning Data Structures with toy code

Coverage PyPI Package

There are some simple implementations of classic data structures, and I am trying to do this with an easy-to-read style.


pip install toydata

Note that: If you had change the default mirror of pip to another one, such as or , you may have to install with pip install toydata -i


Data Structures

  • Stack: ArrayStack, LinkedStack
  • Queue: ArrayQueue, ArrayDeque
  • Deque: LinkedDeque
  • Positional List: PositionalList
  • Priority Queues: UnsortedPriorityQueue, SortedPriorityQueue, HeapPriorityQueue
  • LinkedLists: Singlellist, Doublellist
  • Hash Tables: ChainHashMap, ProbeHashMap, SortedTableMap
  • Trees: LinkedBinaryTree
  • Search Trees: AVLTreeMap, SplayTreeMap, RedBlackTreeMap
  • Graph: Adjacency Map, DFS/BFS, Floyd-Warshall



Data Structures and Algorithms in Python, Michael T. Goodrich is the main reference of the implementations.

Note that there is a book named Data Structures and Algorithms in C++, Michael T. Goodrich which use C++ to implement these data structures.

And Data Structures Using C, Reema Thareja is also a great book that implement these data structures using C.


There some courses that use the book(Data Structures and Algorithms in Python) as textbook.(Tell me please, if you know other courses use it:-)

  1. 数据结构与算法-Python (2019秋季),武汉大学

    Great lecture notes.

  2. Jenny's lectures CS/IT NET&JRF

    Jenny makes everything clear!