Finding an Element in a BST:

def find(root,data):
    currentNode = root
    while currentNode:
        if currentNode.data == data:
            return currentNode
        if data < currentNode.data:
            currentNode = currentNode.left
        else:
            currentNode = currentNode.right

    return None

results matching ""

    No results matching ""