Finding Maximum Element in a BST:

def findMax(root):
    currentNode = root

    if currentNode == None:
        return None
    while currentNode.right != None:
        currentNode = currentNode.right

    return currentNode.data

results matching ""

    No results matching ""