Binary Search Tree Declaration:

class BSTNode:
    def __init__(self,data):
        self.data = data
        self.right = None
        self.left = None

    def setData(self,data):
        self.data = data

    def getData(self):
        return self.data

    def getLeft(self):
    return self.left

    def getRight(self):
        return self.right

The time complexity for a search in BST is O(log n)

results matching ""

    No results matching ""