Skip to content

Commit

Permalink
Fix typo: breath -> breadth
Browse files Browse the repository at this point in the history
  • Loading branch information
delirious-lettuce committed Feb 1, 2018
1 parent d6523e6 commit 511acea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ Inspect tree properties:
>>> root.levels
[[Node(1)], [Node(2), Node(3)], [Node(4), Node(5)]]
Use `level-order (breath-first)`_ indexes to manipulate nodes:
Use `level-order (breadth-first)`_ indexes to manipulate nodes:

.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search

.. code-block:: python
Expand Down
26 changes: 13 additions & 13 deletions binarytree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def __str__(self):
.. note::
To include `level-order (breath-first)`_ indexes in the string, use
To include `level-order (breadth-first)`_ indexes in the string, use
:func:`binarytree.Node.pprint` instead.
.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search
"""
lines = _build_tree_string(self, 0, False, '-')[0]
Expand Down Expand Up @@ -509,7 +509,7 @@ def __len__(self):
return self.properties['size']

def __getitem__(self, index):
"""Return the node/subtree at the give `level-order (breath-first)`_
"""Return the node/subtree at the give `level-order (breadth-first)`_
index.
:param index: The node index.
Expand All @@ -521,7 +521,7 @@ def __getitem__(self, index):
:raise binarytree.exceptions.NodeNotFoundError:
If the target node does not exist.
.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search
**Example**:
Expand Down Expand Up @@ -578,7 +578,7 @@ def __getitem__(self, index):

def __setitem__(self, index, node):
"""Insert the node/subtree into the binary tree at the given
`level-order (breath-first)`_ index.
`level-order (breadth-first)`_ index.
* An exception is raised if the parent node does not exist.
* Any existing node/subtree is overwritten.
Expand All @@ -595,7 +595,7 @@ def __setitem__(self, index, node):
:raise binarytree.exceptions.InvalidNodeTypeError:
If the new node is not an instance of :class:`binarytree.Node`.
.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search
**Example**:
Expand Down Expand Up @@ -651,7 +651,7 @@ def __setitem__(self, index, node):
setattr(parent, 'left' if index % 2 else 'right', node)

def __delitem__(self, index):
"""Remove the node/subtree at the given `level-order (breath-first)`_
"""Remove the node/subtree at the given `level-order (breadth-first)`_
index from the binary tree.
* An exception is raised if the target node does not exist.
Expand All @@ -665,7 +665,7 @@ def __delitem__(self, index):
:raise binarytree.exceptions.NodeNotFoundError:
If the target node or its parent does not exist.
.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search
**Example**:
Expand Down Expand Up @@ -718,7 +718,7 @@ def pprint(self, index=False, delimiter='-'):
"""Pretty-print the binary tree.
:param index: If set to True (default: False), display the
`level-order (breath-first)`_ indexes using the following
`level-order (breadth-first)`_ indexes using the following
format: "{index}{delimiter}{value}".
:type index: bool
:param delimiter: The delimiter character between the node index, and
Expand Down Expand Up @@ -1547,9 +1547,9 @@ def postorder(self):
@property
def levelorder(self):
"""Return the nodes in the binary tree using
`level-order (breath-first)`_ traversal.
`level-order (breadth-first)`_ traversal.
.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search
:return: The list of nodes.
Expand Down Expand Up @@ -1596,10 +1596,10 @@ def levelorder(self):

def build(values):
"""Build a binary tree from a `list representation`_ (i.e. a list of
node values and/or None's in breath-first order) and return its root.
node values and/or None's in breadth-first order) and return its root.
:param values: The list representation (i.e. a list of node values and/or
None's in breath-first order). If a node has an index i, its left child
None's in breadth-first order). If a node has an index i, its left child
is at index 2i + 1, right child at index 2i + 2, and parent at index
floor((i - 1) / 2). None signifies the absence of a node. See example
below for an illustration.
Expand Down
4 changes: 2 additions & 2 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ Inspect tree properties:
>>> root.levels
[[Node(1)], [Node(2), Node(3)], [Node(4), Node(5)]]
Use `level-order (breath-first)`_ indexes to manipulate nodes:
Use `level-order (breadth-first)`_ indexes to manipulate nodes:

.. _level-order (breath-first):
.. _level-order (breadth-first):
https://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_search

.. code-block:: python
Expand Down

0 comments on commit 511acea

Please sign in to comment.