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 AVLNodeBSTNode:
AVL Tree Node class. Inherits from BSTNode
def initself value: object None:
superinitvalue
self.height
self.parent None # Add parent attribute
def strself str:
return 'AVL Node: formatselfvalue
class AVLBST:
AVL Tree class. Inherits from BST
def initself starttreeNone None:
superinit # Initialize empty AVL tree
if starttree:
for value in starttree:
self.addvalue
def addself value: object None:
Add a value to the AVL tree while maintaining balance.
if not self.root:
self.root AVLNodevalue
else:
self.root self.addrecursivelyselfroot, value
self.root.parent None # Ensure root's parent is None
def getminvaluenodeself 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 namemain:
# Basic testing
passAVL Tree Add Test
avl AVL crashed with error 'AVL' object has no attribute addrecursively'
Test Failed: False is not true
AVL Tree Add Test
This test is the same as PDF Example #
You must pass all previous PDF Example tests before this stress test will run.
Test Failed: False is not true
AVL Tree Add Test
avl AVL crashed with error 'AVL' object has no attribute addr
Test Failed: False is not true
AVL Tree Remove Test
avl AVL crashed with error 'AVL' object has no attribute addrecursively'
Test Failed: False is not true
AVL Tree Remove Test
This test is the same as PDF Example #
You must pass all previous PDF Example tests before this stress test will run.
Test Failed: False is not true
AVL Tree Remove Test
avl AVL crashed with error 'AVL' object has no attribute
Test Failed: False is not true
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
