Question: Must be in Java , Include Comments Write a program to build a max-heap using an array. Task #1 Create a basic user interface and

Must be in Java , Include Comments Must be in Java , Include Comments Write a program to build

Write a program to build a max-heap using an array. Task #1 Create a basic user interface and allow user to select one of the following two options (Note that your need to implement both options) (1) Test your program with 5 sets of 100 random positive integers in range 1 to 1000. (No duplicates are allowed). o o (2) Test your program with some random positive integers entered by user (no duplicates are allowed) Implement both methods of building a max heap: Using sequential insertions o oUsing the optimal method. For both methods, you need to keep track of number of swaps (swapping parent and child) required to build a heap For option (1), generate 5 sets of randomly generated integers in range 1 to 1000; compute, print and document (in your project report) the average number of swaps for both methods. Your program should output the average number of swaps for both methods (an average over 5 sets). For option (2), your program should ask user for some positive integers and show the number of swaps and level order tree traversal result

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!