Write a function to implement meansort

Assignment Help Computer Engineering
Reference no: EM131847652

Problem

A different approach to the selection of pivot is to take the mean (average) of meansort all the keys in the list as the pivot. The resulting algorithm is called meansort.

(a) Write a function to implement meansort. The partition function must be modified, since the mean of the keys is not necessarily one of the keys in the list. On the first pass, the pivot can be chosen any way you wish. As the keys are then partitioned, running sums and counts are kept for the two sublists, and thereby the means (which will be the new pivots) of the sublists can be calculated without making any extra passes through the list.

(b) In meansort, the relative sizes of the keys determine how nearly equal the sublists will be after partitioning; the initial order of the keys is of no importance, except for counting the number of swaps that will take place. How bad can the worst case for meansort be in terms of the relative sizes of the two sublists? Find a set of n integers that will produce the worst case for meansort.

Reference no: EM131847652

Questions Cloud

How can earn profit with successful campaigns : Mary is not sure if her customers would appreciate her selling their personal information and how it might affect her business.
Why isnt aspirin recommended for children : Why isnt aspirin recommended for children? Is it relation to Reye's or lack of liver metabolization of certain drugs?
What is the etiological agent of moniliasis : What is the etiological agent of moniliasis and what is the other name for the disease? Why is monilia also common in healthy newborns?
What is the use of this drug to the patient : The nurse explains that shelooked in the package insert and found nothing about using the drug intravenously. What is the use of this drug to the patient?
Write a function to implement meansort : Write a function to implement meansort. The partition function must be modified, since the mean of the keys is not necessarily one of the keys in the list.
How much extra computation will be done : How much extra computation will be done? For n = 7, find an ordering of the keys 1, 2, ... , 7 that will force the algorithm into its worst case.
Prepare a report summarizing crm systems : Create a report summarizing CRM systems and detail how such a system can directly influence Cold Cream's revenues.
Compare the different processes of pharmacokinetics : Compare the different processes of pharmacokinetics and the factors that influence each one. Briefly explain pharmacodynamics and provide an example
What are the manifestations of hyperglycemia : In the report, the PACU nurse instructs that the patient must be monitored for hyperglycemia. What are the manifestations of hyperglycemia?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Select one phase of the database life cycle and describe

per the text the database life cycle includes the database initial study database design implementation and loading

  Implement the function isallzeros

Implement the function "isAllZeros" that uses a loop nested inside another loop to determine whether a two-dimensional array contains only zeros.

  How does a slave station spi send data to the master station

An SCI is transmitting data at 19.2 kbaud. The format is seven data bits. even parity. one stop bit. How long does it take to send a document.

  Computer analysis of the laminar momentum boundary layer

Computer analysis of the laminar momentum boundary layer over a flat plate with a pressure gradient based on u8 = Cxm arid constant properties.

  Three concerns dealing with internet security and privacy

identify and define three concerns dealing with Internet security and privacy?

  Resolving the ambiguities in the software

Describe what you must do in such a situation. You know that cost to your current employer will increase in case the ambiguities are not resolved. Though, you have also a responsibility of confidentiality to your previous employer.

  How to develop a simple scientific calculator

make a Clear button to clear the result text box and reset all controls.

  What is the aim of a disaster recovery plan

What are the five methods of testing a DRP.What is the aim of a Disaster Recovery Plan.

  Xpath and xslt transformation

Explain the context in XPath. Explain at least three things you will require to perform an XSLT transformation.

  Is a shift toward dna based identifications a good idea

What are some of the benefits and limitations of using DNA to identify victims of mass causalities. When answering take into account available resources, types of attacks, evidence collection and preservation, etc.

  What is the effect on the execution time of lda

In the micro program for ASC (Chapter 6), the sequence for indirect address computations is repeated for each ASC instruction requiring that computation.

  Build a 4-bit parallel adder

Build a 4-bit parallel adder by using four "Full Adder" devices.

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