Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement program using Java and arrays, please comment if possible how each method works. Write a program to build a max-heap using an array. Task
Implement program using Java and arrays, please comment if possible how each method works.
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 resultStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started