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.
-
Poor financial performance often is a symptom of poor communication within an organiza- tion. If accounting and marketing communicated about product costs and profits, the mar- keting department...
-
Is there reason to believe that objective probabilities are more reliable than subjective ones? R-3
-
Bertram writes a check for $200 payable to cash. He puts the check in his pocket and drives to the bank to cash the check. As he gets out of his car in the banks parking lot, the check slips out of...
-
Question 3 3 Find the exact value of tan 3 3 tan 3 (Type your answer in radians.)
-
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...
-
On January 1, 2014, Palmer Company acquired a 90% interest in Stevens Company at a cost of $1,000,000. At the purchase date, Stevens Company's stockholders' equity consisted of the following: Common...
-
A 7% annual coupon, $1000 par value, six year bond yields 5%. If yields remain unchanged what should its price be in one year?
-
A 7 - year - to - maturity, quarterly bond is currently trading at $ 1 , 0 8 0 . The YTM is 4 % . What was the interest rate at the time of issuance 1 3 years ago, assuming the bond was issued at par?
-
The restaurant owner is planning to expand the kitchen to cater for the Chinese cooking cuisine. Propose the scope of works in the form of itemized breakdown for the mechanical ventilation system to...
-
Answer all questions with explanation What-If you have $185,500 available for part procurement for a new assembly line equipment, however the invoice amount is $500,000. If the annual interest rate...
-
T-Mobile has a current market value of $35 million and is considering the acquisition of Sprint, whose current market value is $20 million. Both firms are all-equity. A market research study by the...
-
Jennifer Lu is a world- renowned architect. She is in the midst of a divorce with her husband, Johnnie Nu. On the whole the separation has been amicable and civil. Jennifer and Johnnie have agreed to...
-
Using the theoretical sampling strategy, how many samples of size 4 (n = 4) can be drawn from a population of size: (a) N = 5? (b) N = 8? (c) N = 16? (d) N = 50?
-
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)...
-
Managers and accountants gather the information that goes into their cost systems through source documents, which are the original records that support journal entries in an accounting system. True...
-
Top managers of Cole Industries predicted 2 0 2 4 sales of 1 4 , 5 0 0 units of its product at a unit price of $ 8 . 0 0 . Actual sales for the year were 1 4 , 0 0 0 units at $ 1 2 . 5 0 each....
-
For each of the following cases, indicate ( a ) what interest rate columns and ( b ) what number of periods you would refer to in looking up the future value factor. ( 1 ) In Table 1 ( future value...
Study smarter with the SolutionInn App