(self, key)
Insert new key into node
Insert new key into node
Insert new key into node
def insert(self, key):
        """
        Insert new key into node
        """
        # Create new node
        n = TreeNode(key)
        if not self.node:
            self.node = n
            self.node.left = AvlTree()
            self.node.right = AvlTree()
        elif key < self.node.val:
            self.node.left.insert(key)
        elif key > self.node.val:
            self.node.right.insert(key)
        self.re_balance()
def insert ( self , key ) : # Create new node n = TreeNode ( key ) if not self . node : self . node = n self . node . left = AvlTree ( ) self . node . right = AvlTree ( ) elif key < self . node . val : self . node . left . insert ( key ) elif key > self . node . val : self . node . right . insert ( key ) self . re_balance ( )