Question: Write a test program that randomly generates 5 0 0 , 0 0 0 numbers and inserts them into a BST , make another 5

Write a test program that randomly generates 500,000 numbers and inserts them into a BST, make another 500,000 random numbers and performs a search, and reshuffles the numbers again before deleting them from the tree. Write another test program that does the same thing for an AVLTree. Compare the execution times of these two programs. You should submit the source file (.java file) and the screenshot of your execution results.implement BSTimplement AVL 500000 random number generation into array Astarttime BSTfor (int i =0; i 500000; i++){ x = nextrandom number; search from BST}endtime for bststrattime AVLfor (int i =0; i 500000; i++){ x = nextrandom number; search from AVL}endtimeAVL}print endtimeBST - starttimeBST;print endtimeAVL - starttimeAVL;Write a test program that randomly generates 500,000 numbers and inserts them into a BST, make another 500,000 random numbers and performs a search, and reshuffles the numbers again before deleting them from the tree. Write another test program that does the same thing for an AVLTree. Compare the execution times of these two programs. You should submit the source file (.java file) and the screenshot of your execution results.
implement BST
implement AVL
500000 random number generation into array A
starttime BST
for (int i=0;i500000;i++
x= nextrandom number;
search from BST
}
endtime for bst
strattime AVL
for (int i=0;i500000;i++
x= nextrandom number;
search from AVL
}
endtimeAVL
}
print endtimeBST - starttimeBST;
print endtimeAVL - starttimeAVL;
Write a test program that randomly generates 500,000 numbers and inserts them into a BST, make another 500,000 random numbers and performs a search, and reshuffles the numbers again before deleting them from the tree. Write another test program that does the same thing for an AVLTree. Compare the execution times of these two programs. You should submit the source file (.java file) and the screenshot of your execution results.
implement BST
implement AVL
500000 random number generation into array A
starttime BST
for (int i=0;i500000;i++
x= nextrandom number;
search from BST
}
endtime for bst
strattime AVL
for (int i=0;i500000;i++
x= nextrandom number;
search from AVL
}
endtimeAVL
}
print endtimeBST - starttimeBST;
print endtimeAVL - starttimeAVL;
Write a test program that randomly generates 5 0

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!