Question: I added my code below and i keep getting these error codes please help from bst import BSTNode, BST # Updated import statement class AVLNode

I added my code below and i keep getting these error codes please help from bst import BSTNode, BST # Updated import statement
class AVLNode(BSTNode):
"""
AVL Tree Node class. Inherits from BSTNode
"""
def __init__(self, value: object)-> None:
super().__init__(value)
self.height =0
self.parent = None # Add parent attribute
def __str__(self)-> str:
return 'AVL Node: {}'.format(self.value)
class AVL(BST):
"""
AVL Tree class. Inherits from BST
"""
def __init__(self, start_tree=None)-> None:
super().__init__() # Initialize empty AVL tree
if start_tree:
for value in start_tree:
self.add(value)
def add(self, value: object)-> None:
"""
Add a value to the AVL tree while maintaining balance.
"""
if not self._root:
self._root = AVLNode(value)
else:
self._root = self._add_recursively(self._root, value)
self._root.parent = None # Ensure root's parent is None
def _get_min_value_node(self, node: AVLNode)-> AVLNode:
"""
Get the node with the minimum value in the subtree rooted at the given node.
"""
current = node
while current.left:
current = current.left
return current
# Rest of your AVL implementation remains unchanged
# ------------------- BASIC TESTING -----------------------------------------
if __name__=='__main__':
# Basic testing
passAVL Tree - Add - Test 1(0/5)
avl = AVL ((1,2,3)) crashed with error 'AVL' object has no attribute '_add_recursively'
Test Failed: False is not true
AVL Tree - Add - Test 2(0/5)
This test is the same as PDF Example #3
You must pass all previous PDF Example tests before this stress test will run.
Test Failed: False is not true
AVL Tree - Add - Test 3(0/10)
avl =AVL([-25,11,-17,81,23,86,-9,90,-2]) crashed with error 'AVL' object has no attribute '_add_r
Test Failed: False is not true
AVL Tree - Remove - Test 1(0/5)
avl =AVL((1,2,3)) crashed with error 'AVL' object has no attribute '_add_recursively'
Test Failed: False is not true
AVL Tree - Remove - Test 2(0/5)
This test is the same as PDF Example #5
You must pass all previous PDF Example tests before this stress test will run.
Test Failed: False is not true
AVL Tree - Remove - Test 3(010)
avl =AVL([33,-61,37,12,-16,-14,51,-72,-100,95]) crashed with error 'AVL' object has no attribute
Test Failed: False is not true
 I added my code below and i keep getting these error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!