MCPcopy Create free account
hub / github.com/geekcomputers/Python / inorder

Function inorder

binary_search_trees/inorder_traversal.py:5–19  ·  view source on GitHub ↗

This function performs an inorder traversal of a BST

(root: Optional[Node])

Source from the content-addressed store, hash-verified

3
4
5def inorder(root: Optional[Node]) -> None:
6 """This function performs an inorder traversal of a BST"""
7
8 # The inorder traversal of a BST is the nodes in increasing order
9 if root is None:
10 return
11
12 # Traverse the left subtree
13 inorder(root.left)
14
15 # Print the root node
16 print(root.data)
17
18 # Traverse the right subtree
19 inorder(root.right)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected