Add example

This commit is contained in:
Luke Murphy 2019-10-06 15:29:34 +02:00
parent be91ee85fe
commit 57933a0ef6
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -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