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

  Define economic terms used for choosing projects

Describe the influences of funding, timing, and unofficial considerations on project selection.

  A change to my coin tossing program

A change to my Coin Tossing program

  What tasks are performed by the transport layer

What is the major function of the network access layer?

  What are the common activities conducted

What are the common activities conducted during construction phase in the software development life cycle? What quality control measures are taken during construction phase? What is done to construct a software application at faster speed?

  When does r display character vectors/strings without quotes

when does R display character vectors/strings without quotes?

  Explain why data security is important

Name and briefly describe three methods of breaching data security. Which do you think is potentially the most serious? Explain.

  Write a menu-driven program to manage a membership

Write a menu-driven program to manage a membership list. Assume that the names and phone numbers of all members are stored in alphabetical order (by last name and then by first name) in the text file MemberPhones.txt

  Implement the level order traversal

Write a recursive function named search that takes as input the pointer to the root of a binary tree (not a BST!) and a value K, and returns true if value K appears in the tree and false otherwise.

  Difference between systems analysis and systems design

Illustrate the difference between systems analysis and systems design. What is the goal of each phase? What are the ramifications of finding flaws during the analysis phase or the design phase?

  Development of an effective approach to physical security

Using the required reading and any other resources you might find helpful, write a paper regarding development of an effective approach to physical security within the project organization. Be sure to cover the following topics:

  Write a generic list type for c

Do the same for C++ by defining a template and for Java by defining a class that holds lists of type Object. What are the strengths and weaknesses of the various languages for this job?

  Using the it planning at modmeter case study

Using the "IT Planning at ModMeters" case study , describe which processes in the COBIT governance model would assist ModMeters in their planning processes and why. Refer to the COBIT reference material and websites in the Readings and Resources fold..

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