New here, so apologies for any broken decorum. I'm trying to write code for a BST that has a method that builds the BST using a sorted array. I keep getting the RecursionError: Maximum recursion depth exceeded. First time posting because I feel so lost :( Appreciate any help.
class Node:
    def __init__(self, key):
        self.key = key
        self.left = None
        self.right = None
class BinarySearchTree:
    def __init__(self, sorted_array):
        self.root = None
        self.sorted_array=sorted_array
    def build_tree(self, sorted_array):
        if not self.sorted_array:
            return None
        mid = len(sorted_array) // 2
        root = Node(self.sorted_array[mid])
        root.left = self.build_tree(self.sorted_array[0:mid])
        root.right = self.build_tree(self.sorted_array[mid + 1:])
        return root
example_array=[1, 3, 4, 5, 7, 8, 9, 23, 67, 324, 6345]
my_tree=BinarySearchTree()
my_tree.build_tree(example_array)
 
     
     
    