Explain sorting algorithm which is optimal in cost

Assignment Help Data Structure & Algorithms
Reference no: EM1348856

1. Suppose we are given n numbers, initially stored in an array A and we wish to sort them. When the sort concludes, the sorted output is to be in the array A, in ascending order (i.e., the smallest value in A[0], the next smallest in A[1], etc.). Suppose we use, as our measure of time, the number of times we store a value into the array. In other words,

If x is any value, an assignment statement of the form A[i] = x has a cost of 1.

In particular, an assignment statement of the form A[i] = A[j ] has a cost of 1.

Any other operation (including a comparison between two array items A[i] and A[j ], or an assignment x = A[i] where x is not a location in the array A) has a cost of 0.

(a) Under this cost model, give a lower bound on the worst-case time required to sort the array A. Your answer should be an exact expression in terms of n (i.e., it should not involve asymptotic notation).

(b) Describe a sorting algorithm that is optimal with respect to this cost model and uses O(n) space. That is, time used by your algorithm should exactly match the lower bound given in (a).) Explain why your algorithm satis?es the cost and space requirements.

(c) Describe an in-place sorting algorithm that is optimal with respect to this cost model. That is, the time used by your algorithm should exactly match the lower bound given in (a).) Explain why your algorithm satis?es the cost requirement and is in-place.

Reference no: EM1348856

Questions Cloud

Examples of variable cost for a fitness center : One way to own your own fitness business is to buy a franchise. Snap Fitness is a Minnesota-based business that offers franchise opportunities. For a very low monthly fee ($26, without an annual contract) customers can access a Snap Fitness center..
Illustrate marginal tax rate alter his level of charitable : Illustrate by how much (what percentage) does the consumer facing a 15% marginal tax rate alter his or her level of charitable giving as the result of the deductibility of charitable contributions?
Evaluate the appropriate authority and control structure : What factors evaluate the appropriate authority and control structure - a research and development laboratory
Find the last price at stock traded : Machines stock was found in the Thursday, December 14, issue of the Wall Street Journal. AdvBusMach ABM 81.75 1.63 Given this data, answer the questions:
Explain sorting algorithm which is optimal in cost : Explain a sorting algorithm which is optimal with respect to this cost model and uses O(n) space. That is, time used by algorithm should exactly match lower bound
Master of science in psychology : Master of Science in Psychology with a concentration in Industrial Organizational Psychology.
What is the rationale in allowing express oral agencies : Express authority - Explain what is the rationale in allowing express oral agencies (i.e., no prior written contract) to bind principals
How fast must a centrifuge rotate : A 4.25 bullet traveling horizontally with a velocity of magnitude 375 is fired into a wooden block with mass 1.10 , initially at rest on a level frictionless surface. The bullet passes by the block and emerges with its speed reduced to 110 .
Compute the average number of customers in line : Compute the average number of customers in line for both scenarios and What benefit is available by adding the second service line

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explain types of information systems

Question 1. Explain five types of information systems, and give an example of each. Question 2. Describe three common reasons for a systems request. Try and find one not listed in the text.

  Factors-principles considering indecency regulation issues

What factors and principles should the federal government take into account when considering indecency regulation issues?

  Finding equation has no solutions mod m

Let the equation ax = b mod m, where x is unknown and a, b and m are given. Illustrate that this equation has either no solutions mod m, or d solutions mod m.

  Algorithm to produce a list of customers

Draw an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file.

  Write a c++ program to find the intersection

Write a C++ program to find the intersection, A set is a collection of distinct entities regarded as a unit, being either individually specified or (more usually) satisfying specified conditions.

  Sorting arrays of name in descending order

Then sort arrays so that records are in descending order by purchase amount for month. Output lists the names of the top five customers.

  Algorithm to divide sixteen digit value by six digit integer

Divide 16 digit value N by six digit integer D obtaining quotient Q and remainder (or sign of the remainder) R by division algorithms.

  Advantage of fast running time of insertion sort

Running time of quicksort can be enhanced in practice by taking advantage of fast running time of insertion sort when its input is "nearly" sorted.

  Implementation of graph

Give the two input nodes after the graph has been built from the command prompt.

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  Write down the algorithm to insert an item

Write down the sample code to create a Linked List and allocate storage space for a node Write down the algorithm to insert an item At the beginning of a linked list

  Steps of asymmetric encryption algorithms to read message

Using only asymmetric encryption algorithms write down any steps taken by Bob which permit him to read the message.

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