Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java Description: Write a program to build a max-heap using an array Task #1 Create a basic user interface and allow user to select

In java image text in transcribed
Description: 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 o (No duplicates are allowed). 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 o Using 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 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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions