MCPcopy Index your code
hub / github.com/geekcomputers/Python / inorder_successor

Function inorder_successor

binary_search_trees/inorder_successor.py:4–13  ·  view source on GitHub ↗

This function returns the inorder successor of a node in a BST

(root: Node)

Source from the content-addressed store, hash-verified

2
3
4def inorder_successor(root: Node) -> Node:
5 """This function returns the inorder successor of a node in a BST"""
6
7 # The inorder successor of a node is the node with the smallest value greater than the value of the node
8 current: Node = root
9
10 # The inorder successor is the leftmost node in the right subtree
11 while current.left is not None:
12 current = current.left
13 return current

Callers 1

delete_nodeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected