Add example
This commit is contained in:
parent
be91ee85fe
commit
57933a0ef6
28
README.rst
28
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
|
||||
|
Loading…
Reference in New Issue
Block a user