Perform a study of Shellsort, using different increments. Compare the version shown in Section 7.3 , where
Question:
Perform a study of Shellsort, using different increments. Compare the version shown in Section 7.3 , where each increment is half the previous one, with others. In particular, try implementing “division by 3” where the increments on a list of length n will be n=3, n=9, etc. Do other increment schemes work as well?
Transcribed Image Text:
7.3 Shellsort The next sort we consider is called Shellsort, named after its inventor, D.L. Shell. It is also sometimes called the diminishing increment sort. Unlike Insertion and Selection Sort, there is no real life intuitive equivalent to Shellsort. Unlike the exchange sorts, Shellsort makes comparisons and swaps between non-adjacent el- ements. Shellsort also exploits the best-case performance of Insertion Sort. Shell- sort's strategy is to make the list "mostly sorted" so that a final Insertion Sort can finish the job. When properly implemented, Shellsort will give substantially better performance than (n) in the worst case. Shellsort uses a process that forms the basis for many of the sorts presented in the following sections: Break the list into sublists, sort them, then recombine the sublists. Shellsort breaks the array of elements into "virtual" sublists. Each sublist is sorted using an Insertion Sort. Another group of sublists is then chosen and sorted, and so on. During each iteration, Shellsort breaks the list into disjoint sublists so that each element in a sublist is a fixed number of positions apart. For example, let us as- sume for convenience that n, the number of values to be sorted, is a power of two. One possible implementation of Shellsort will begin by breaking the list into n/2 sublists of 2 elements each, where the array index of the 2 elements in each sublist differs by n/2. If there are 16 elements in the array indexed from 0 to 15, there would initially be 8 sublists of 2 elements each. The first sublist would be the ele- ments in positions 0 and 8, the second in positions 1 and 9, and so on. Each list of two elements is sorted using Insertion Sort.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (QA)
Java import javautilArrays public class ShellsortComparison public static void mainString args int a...View the full answer
Answered By
Aysha Ali
my name is ayesha ali. i have done my matriculation in science topics with a+ . then i got admission in the field of computer science and technology in punjab college, lahore. i have passed my final examination of college with a+ also. after that, i got admission in the biggest university of pakistan which is university of the punjab. i am studying business and information technology in my university. i always stand first in my class. i am very brilliant client. my experts always appreciate my work. my projects are very popular in my university because i always complete my work with extreme devotion. i have a great knowledge about all major science topics. science topics always remain my favorite topics. i am also a home expert. i teach many clients at my home ranging from pre-school level to university level. my clients always show excellent result. i am expert in writing essays, reports, speeches, researches and all type of projects. i also have a vast knowledge about business, marketing, cost accounting and finance. i am also expert in making presentations on powerpoint and microsoft word. if you need any sort of help in any topic, please dont hesitate to consult with me. i will provide you the best work at a very reasonable price. i am quality oriented and i have 5 year experience in the following field.
matriculation in science topics; inter in computer science; bachelors in business and information technology
_embed src=http://www.clocklink.com/clocks/0018-orange.swf?timezone=usa_albany& width=200 height=200 wmode=transparent type=application/x-shockwave-flash_
4.40+
11+ Reviews
14+ Question Solved
Related Book For
Practical Introduction To Data Structures And Algorithm Analysis Java Edition
ISBN: 9780136609117
1st Edition
Authors: Clifford A. Shaffer
Question Posted:
Students also viewed these Computer science questions
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Homework-2 DECISION ANALYSIS PROBLEMS Problem-1: Kenneth Brown is the principal owner of Brown Oil, Inc. After quitting his university teaching job, Ken has been able to increase his annual salary by...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Suppose there are three buyers of candy in a market: Tex, Dex, and Rex. The market demand and the individual demands of Tex, Dex, and Rex are shown on the next page. a. Fill in the table for the...
-
A mass m1 hangs vertically from a string connected to a ceiling. A second mass m2 hangs below m1 with m1 and m2 also connected by another string. Calculate the tension in each string.
-
Table 6.2 lists the range of typical volume flow rates for centrifugal fire-fighting pumps to be 500 to 2500 gal/min. Express this range in the units of ft 3 /s and m 3 /s. Flow rate (m/h) Type of...
-
Larry Riley formed a rental agreement for a self-storage unit with Iron Gate Self Storage in December 2003. The agreement stated that a maximum of \($5,000\) of personal property could be stored in...
-
Elizabeth Bailey is the owner and general manager of Princess Brides, which provides a wedding planning service in Southwest Louisiana. She uses radio advertising to market her business. Two types of...
-
Explain what a database management system is. Describe the functions of a database management system. 5 Paragraph Essay Intro ,Body , Conclusion
-
The implementation for Mergesort given in Section 7.4 takes an array as input and sorts that array. At the beginning of Section 7.4 there is a simple pseudocode implementation for sorting a linked...
-
Write your own collection of sorting programs to implement the algorithms described in this chapter, and compare their running times. Be sure to implement optimized versions, trying to make each...
-
To illustrate the concept consider the situation where 16 randomly-selected people were chosen to measure the effectiveness of a new training programme on the value of sales. For the training...
-
Q16) What is the most that you would pay for an investment that promises to pay$14,812.00a year forever with the first payment starting one year from now?Assume that your required rate of return for...
-
The Company's Audit Committee charter requires that the Audit Committee review and approve all related party transactions required to be disclosed pursuant to SEC rules. In doing so, the Audit...
-
The best answer for why the Fan Cost Index (FCI) for attending live sporting events can be useful is: Group of answer choices Teams could determine if their fan costs are reasonable, given other...
-
Creditors are MOST concerned with which financial information which will tell them Question 11 options: a) if the company has enough cash to pay dividends. b) whether the company meets all tax...
-
Answer each part by using well-labelled graphs for the IS-LM, WS-PS and AS-AD models: a) Assume that Australian government has made it very difficult for refugees (who are prepared to work at lower...
-
Austin Enterprises makes and sells three types of dress shirts. Management is trying to determine the most profitable mix. Sales prices, demand, and use of manufacturing inputs follow: The company...
-
When an electric field is applied to a shallow bath of vegetable oil, why do tiny bits of thread floating in the oil align with the field like compasses in a magnetic field?
-
Although keys in a map are distinct, the binary search algorithm can be applied in a more general setting in which an array stores possibly duplicative elements in nondecreasing order. Consider the...
-
Describe how to perform a removal from a hash table that uses linear probing to resolve collisions where we do not use a special marker to represent deleted elements. That is, we must rearrange the...
-
Consider the goal of adding entry (k,v) to a map only if there does not yet exist some other entry with key k. For a map M (without null values), this might be accomplished as follows. if (M.get(k)...
-
What powers the alternate system for extending the flaps in a Cessna-182RG? Group of answer choices Manual (Pilot) operation A backup electrical motor There is none; the aircraft can be safely landed...
-
The pendulum's period is measured to be 4.00 s in the reference frame of the pendulum. What is the period (in sec) when measured by an observer moving at a speed of 0.88c relative to the pendulum?
-
Describe Quality ratings i. Excellent ii. Exceeding National Quality Standard iii. Meeting National Quality Standard iv. Working Towards National Quality Standard v. Significant Improvement Required?
Study smarter with the SolutionInn App