Write a program that will iterate 1000 times

Assignment Help Basic Computer Science
Reference no: EM131399509

You can study the average performance of the first step in a heap sort-building the initial heap-by taking the following steps:

• Modify the method reheap so that it returns the number of calls made to compareTo.

• Write a program that will iterate 1000 times. During each iteration, generate n random values and place them into an array. Count the number of comparisons needed by the code given in Exercise 7 to convert the array into a heap. Add the number of comparisons in each iteration into a total. After the loop has ended, compute the average number of comparisons needed to build the heap by dividing the number of comparisons by 1000.

• In the previous step, let n = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 400, and 800. For each n, see whether the average number of calls to compareTo is greater than or equal to the lower bound n - 1 (see Exercise 7) and less than or equal to the upper bound n log2 n

Reference no: EM131399509

Questions Cloud

Determining the behavioral design pattern : Select and submit a Behavioral Design Pattern; explain why you selected that particular pattern.
Insert a print screen of the display settings : How do you show hidden files, folders, and drives in Windows 7? Explain how an insert a print screen image of the Folder Options dialog box in Windows 7.
Compare the values of the range for the two groups : Find the five-number summary for Group 1.- Find the five-number summary for Group 2.- Compare the values of the range for the two groups.
Administrators to change the id assigned : The DoGood Donor application contains a page that allows administrators to change the ID assigned to a donor in the DD_DONOR table. Create a PL/SQL block to handle this task.
Write a program that will iterate 1000 times : In the previous step, let n = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 400, and 800. For each n, see whether the average number of calls to compareTo is greater than or equal to the lower bound n - 1 (see Exercise 7) and less than or equal to..
Describe the shape of given dataset : Create a dotplot for these ages.-  Describe the shape of this dataset.-  Are there any outliers in this dataset?- Create a stem-and-leaf plot for these ages.
Write an efficient algorithm for combining two heaps : Write an efficient algorithm for combining two heaps, one with size n and the other with size 1. What is the Big Oh performance of your algorithm?
What is average length of service for staff in organization : What is the average length of service for staff in the organization? What percentage of respondents would recommend the organization to others as a good place to work?
Where in the tree will the largest entry occur : Use a binary search tree in the implementation of MaxHeapInterface. Where in the tree will the largest entry occur? How efficient is this implementation?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Bank ui implementations

The Model View Controller (MVC) pattern was first documented in The Journal of Object Technology in 1988, but was first implemented as early as the 1970s. The MVC pattern is used when designing user interfaces. As its name suggests, the MVC is sep..

  Derive the isoefficiency function of this scheme

derive the isoefficiency function of this scheme.

  Determine the outlet temperature of the water

Determine the UA product of a counter flow heat exchanger required for the chilling process. Determine the length of the exchanger if the inner pipe has a 50-mm diameter and the overall heat transfer coefficient is U = 1000 W/m2 . K.

  How may seeded faults does the richards formula require

If for some reason you do not intend to find all seeded faults, how may seeded faults does the Richards formula require?

  Describe the graphical coordinate system in java

How do you specify a particular color to be used as fill when using the Graphics class?

  Calculate the normalized average power

Calculate the normalized average power.

  Instances of attribute minimization

Describe attribute minimization. Explain what would happen if you tried to validate a page containing instances of attribute minimization. Propose a solution to this problem.

  Create a class titled schooltextbook that contains fields

Create a class titled SchoolTextBook that contains fields for the author, title, page count, ISBN, and price. This SchoolTextBook class will also provide setter and getter methods for all fields.

  Explain the role of each p in software engineering

Effective software project management focuses on the four P's: people, product, process, and project. Explain the role of each P in software engineering.

  Determine the amount of heat transfer in the regenerator

Air enters the compressor of a regenerative gasturbine engine at 310 K and 100 kPa, where it is compressed to 900 kPa and 650 K.

  Managing electronic transactions through mobile devices

Mobile devices offer quick access to resources and enable electronic transactions from practically anywhere. The emergence and evolution of mobile devices have opened up a new domain of security concerns: mobile security. Mobile devices, if not pr..

  What happens if newton''s method is applied

What happens if Newton's method is applied to find this saddle point?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd