Difference in the number of comparisons become significant

Assignment Help Basic Computer Science
Reference no: EM131076863

The Shell sort (named for its inventor, Donald Shell) is an improved insertion sort. Rather than always exchanging adjacent items-as in an insertion sort-the Shell sort can exchange items that are far apart in the array. The Shell sort arranges the array so that every hth item forms a sorted subarray in a decreasing sequence of values. For example, if h is 5, every fi fth item forms a sorted subarray. Ultimately, if h is 1, the entire array will be sorted. One possible sequence of h 's begins at n / 2 and halves n until it becomes 1. By using this sequence, and by replacing 1 with h and 0 with h - 1 in insertion Sort, we get the following function for the Shell sort:

528_3b713dcd-1768-4348-a59d-4e82c6cdc6bd.png

Add a counter to the functions insertion Sort and shell Sort that counts the number of comparisons that are made. Run the two functions with arrays of various sizes. At what size does the difference in the number of comparisons become significant?

Reference no: EM131076863

Questions Cloud

What caused the dramatic changes to the american family : Why is the family considered the most important agent of socialization? What caused the dramatic changes to the American family? What are those changes?
What is the rate of change of the radius : I blow up a spherical balloon at a rate of 10 cm3 per second.  What is the rate of change of the radius when the balloon has radius 5 cm
List and describe the key agents of socialization : Identify and describe Kohlberg's three stages of moral development and explain how each stage applies to your own personality formation. Do you agree with Kohlberg, who suggested that the third stage is difficult for many people in our society to ..
Draw the inductor voltage and current waveforms : Problem 1. Calculate the rms value of the following waveforms (1) v(t) =15 sin(2g600
Difference in the number of comparisons become significant : Add a counter to the functions insertion Sort and shell Sort that counts the number of comparisons that are made. Run the two functions with arrays of various sizes. At what size does the difference in the number of comparisons become significant?
What would the minimum required annual savings : If the annual operating cost increases by 20%, from $2,750 to $3,300, what would the minimum required annual savings to get the 10% return on investment?
Determine whether set is empty will require nonconstant time : An advantage of choosing this implementation of "set of integers" is that adding an element to a set is a contact time operation. Which of the following is a disadvantage of this implementation? Adding elements to a very small sets could cause err..
List the calls to merge sort and to merge : Trace the merge sort algorithm as it sorts the following array into ascending order. List the calls to merge Sort and to merge in the order in which they occur
Change in velocity of the scooter : A motor scooter travels east at a speed of 9 m/s. The driver then reverses direction and heads west at 20 m/s. What was the change in velocity of the scooter?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Statistical analysis approaches

The Portfolio Project, due at the end of Week 8, is a statistical analysis using one or more of the statistical analysis approaches presented in Modules 4 and 5. These various approaches are designed to produce business intelligence to resolve pro..

  Describe how to recover file for further investigation

When you try to open file in image viewer, message is displayed indicating that file is corrupt. Write 2-3 page report describing how to recover the file, orkty.zip, for further investigation.

  Difference between bounded and unbounded media

Explain the difference between bounded and unbounded media, and provide examples of each that are commonly found in homes, schools, or area businesses.

  Mobile technologies in a user-friendly manner

The items need to be easily searchable and of sufficiently high resolution for details to be viewed. They need to be accessible through mobile technologies in a user-friendly manner. The University also wants a way to protect the copyright of the ..

  Create a 64mb encrypted file system

Write an instruction sheet for the user so that she can make the modi cations to her home machine so that she can access the le on the ash drive containing the encrypted le system.

  Web service management

How is Web service management different from conventional distributed computing  systems management?

  How light source is treated during ray tracing processing

Typically, this setting is left at default until final renderings are being produced. To reduce gaps or facets in rendering which setting do you adjust?

  Design and implement a class to play a game called pig

design and implement a class to play a game called Pig

  Wiring system solution to an electrical problem

Wiring system solution to an electrical problem

  Identify the specific manufacture and model

From the first e-Activity, identify the specific manufacture and model of one (1) magnetic disk, one (1) solid state drive, and one (1) optical drive.

  What are the risks associated with throwing out old info

1. What are the risks associated with throwing out old information systems and replacing them with new information systems? Provide examples to support your answer.

  Describe project integration management

Compare a traditional task oriented work breakdown structure with a user story based product backlog. What are the advantages and disadvantages of each approach to enumerating work to be done?

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