diff --git a/README.rst b/README.rst index c4a2a44..45c7802 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,34 @@ From `The Dat Protocol`_: them uniquely efficient and convenient to implement in a wide range of languages. +.. _example: + +Example +******* + +.. code-block:: python + + """ + + You can represent a binary tree in a simple + flat list using the following structure: + + 3 + 1 5 + 0 2 4 6 ... + + This module exposes a series of functions + to help you build and maintain this data structure. + + """ + + from flat_tree import FlatTreeAccessor + + tree_access = FlatTreeAccessor() + + # get array index for depth: 1, offset: 0 + tree_access.index(1, 0) + .. _documentation: Documentation