Question
C++ The purpose of this assignment is to explore several strategies for shellsort gap sequences and write a paper explaining your results. You are to
C++
The purpose of this assignment is to explore several strategies for shellsort gap sequences and write a paper explaining your results. You are to explore Shells original gap sequence (gap sequence type 1; see below), Hibbards sequence (type 2), and one other that you find by researching the topic (type 3).
You will need to write a program that implements shellsort. You must use the exact algorithm for shellsort (Given below), except that you must alter the gap array handling as described below.
Your main program must run in two different modes. In mode 1, the command line specifies the size of a randomly generated array and the gap sequence to be used. For example, the command line: ./program 1 500000 2 means to run the program in mode 1 with an array of 500,000 randomly generated values using Hibbards sequence.
In mode 2, the command line specifies the name of the file to use containing the data to load into the array (whitespace separated) and the gap sequence to be used. For example, the command line: ./program 2 ascending.dat 3 means to run the program in mode 2, with the array filled with the values in the file ascending.dat, using the sequence you found via research .
In each case, your program must output the final sorted array space separated on one line of the cout stream, newline terminated, and the input size and number of basic operations on one line of the cerr stream, newline terminated.
Shell Sort Algorithm:
void shellsort(vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started