Question

Problem 4 (5 marks). Hibbard’s gap sequence for Shellsort is defined as follows. 2 k −...

Problem 4 . Hibbard’s gap sequence for Shellsort is defined as follows.

2 k − 1, 2 k−1 − 1, 2 k−2 − 1, . . . , 7, 3, 1

where k is the largest number satisfying 2k − 1 < N.

(b) Implement Shellsort with Hibbard’s gap sequence, with Shell’s gap sequence, and with a gap sequence of your own invention, and compare them on three input/output examples for duplicate-free arrays of size 10, 100, and 1000 (one of each size). Report the number of comparisons made in each case.

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
JAVA please Arrays are a very powerful data structure with which you must become very familiar....
JAVA please Arrays are a very powerful data structure with which you must become very familiar. Arrays hold more than one object. The objects must be of the same type. If the array is an integer array then all the objects in the array must be integers. The object in the array is associated with an integer index which can be used to locate the object. The first object of the array has index 0. There are many problems where...
1. Explain and give examples of the 5 existing business model patterns. 2. Can the business...
1. Explain and give examples of the 5 existing business model patterns. 2. Can the business below use that business model pattern? Explain. Overview- We are going to start a bakery business as I have my interest in bakery. This is going to be start-up business plan. The name of our Bakery would be “Bake It or Make It”. It would be managed by me along with my team of new bakers around the city. Opening a bakery at initial...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
Team 5 answer the questions What are 4 key things you learned about the topic from...
Team 5 answer the questions What are 4 key things you learned about the topic from reading their paper? How does the topic relate to you and your current or past job? Critique the paper in terms of the organization and quality. Incentive Systems             In this paper, we will focus primarily on financial rewards that companies use to attract, retain and motivate the brightest and most talented candidates in the labor market. By providing a reward system that...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant agency which integrates the supply chain for companies B. A 2 PL or a 3PL, but not a 4PL C. A company supplying transportation and warehousing services D. A logistics service company specialized in suppling VAS (value added services) 2. What characterizes a 4 PL? (1 point) A. They are non-asset based and provides integrated services primarily supplied by asset based providers, for example...
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...
Wal-Mart Online Wal-Mart is one of the largest companies in America. It is definitely the largest...
Wal-Mart Online Wal-Mart is one of the largest companies in America. It is definitely the largest retailer, both in terms of the number of stores (8,970 worldwide in 2011) and the level of sales ($419 billion from the 2011 Annual Report). By pushing suppliers to continually reduce costs, Wal-Mart is known for pursuing low prices and the stores often attract customers solely in-terested in lower prices. With Wal-Mart’s expansion into groceries, the company has be-come the largest retail grocer in...
Gender Bias in the Executive Suite Worldwide The Grant Thornton International Business Report (IBR) has described...
Gender Bias in the Executive Suite Worldwide The Grant Thornton International Business Report (IBR) has described itself as "a quarterly survey of business leaders from across the globe … surveying 11,500 businesses in 40 economies across the globe on an annual basis." 1 According to the 2011 IBR, the Asia Pacific region had a higher percentage (27 percent) of female chief executive officers (CEOs) than Europe and North America. Japan is the only Asia Pacific region exception. The report further...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...