Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

administer a survey to an appropriate sample of respondents;

Answered: 1 week ago

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago