Question: from AVLNode import AVLNodeclass ExtendedAVLNode ( AVLNode ) : def _ _ init _ _ ( self , node _ key ) : super (

from AVLNode import AVLNodeclass ExtendedAVLNode(AVLNode):def __init__(self, node_key):super().__init__(node_key)self.subtree_key_count = update_subtree_key_count(self,node_key)def get_subtree_key_count(self):return self.subtree_key_countdef update_subtree_key_count(self,key):leftcount = self.left.get_subtree_key_count(key)rightcount = self.right.get_get_subtree_key_count(key)subTreeKeyCount = leftcount + rightcount +1return subTreeKeyCountTest 1- insertion and GetSubtreeKeyCount() Inserting keys: [10,20,30,55,42,19,77] Runtime error while executing test case Test 2- insertion, removal, and GetSubtreeKeyCount() Inserting keys: [86,75,23,30,98,67,53,9,19,58,14] Runtime error while executing test case Test 3- insertion, removal, GetSubtreeKeyCount(), and GetNthKey() Inserting keys: [10,58,66,18,34,96,5,48,73,62,36,16,23,99,92,95,46,97] Runtime error while executing test case Summary: Test 1: FAIL Test 2: FAIL Test 3: FAILPlease help with error, only change ExtendAVLNode.py Program output displayed here
Test 1- insertion and GetSubtreeKeyCount()
Inserting keys: [10,20,30,55,42,19,77]
PASS: Inorder key verification
Expected: [10,19,20,30,42,55,77]
Actual: [10,19,20,30,42,55,77]
FAIL: Node with key 10 has a subtree count of 1, but the expected subtree key count is 2
PASS: Node with key 19 has a subtree key count of 1
FAIL: Node with key 20 has a subtree count of 1, but the expected subtree key count is 7
PASS: Node with key 30 has a subtree key count of 1
FAIL: Node with key 42 has a subtree count of 1, but the expected subtree key count is 4
FAIL: Node with key 55 has a subtree count of 1, but the expected subtree key count is 2
PASS: Node with key 77 has a subtree key count of 1
Test 2- insertion, removal, and GetSubtreeKeyCount()
Inserting keys: [86,75,23,30,98,67,53,9,19,58,14]
PASS: Inorder key verification
Expected: [9,14,19,23,30,53,58,67,75,86,98]
Actual: [9,14,19,23,30,53,58,67,75,86,98]
FAIL: Node with key 9 has a subtree count of 1, but the expected subtree key count is 2
PASS: Node with key 14 has a subtree key count of 1
FAIL: Node with key 19 has a subtree count of 1, but the expected subtree key count is 4
PASS: Node with key 23 has a subtree key count of 1
FAIL: Node with key 30 has a subtree count of 1, but the expected subtree key count is 11
PASS: Node with key 53 has a subtree key count of 1
FAIL: Node with key 58 has a subtree count of 1, but the expected subtree key count is 3
PASS: Node with key 67 has a subtree key count of 1
FAIL: Node with key 75 has a subtree count of 1, but the expected subtree key count is 6
FAIL: Node with key 86 has a subtree count of 1, but the expected subtree key count is 2
PASS: Node with key 98 has a subtree key count of 1
Test 3- insertion, removal, GetSubtreeKeyCount(), and GetNthKey()
Inserting keys: [10,58,66,18,34,96,5,48,73,62,36,16,23,99,92,95,46,97]
PASS: Inorder key verification
Expected: [5,10,16,18,23,34,36,46,48,58,62,66,73,92,95,96,97,99]
Actual: [5,10,16,18,23,34,36,46,48,58,62,66,73,92,95,96,97,99]
FAIL: get_nth_key(11) returned 0, but expected key is 66
Surmary:
Test 1: FAIL
Test 2: FAIL
Test 3: FAIL
from AVLNode import AVLNodeclass ExtendedAVLNode

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 Programming Questions!