Distinct sorting algorithms

Assignment Help Basic Computer Science
Reference no: EM131607678

Compare the performance of two distinct sorting algorithms to obtain some appreciation for the parameters to be considered in selecting an appropriate sort. Please formulate a HeapSort and a Shell Sort. They should both be recursive or both be iterative, so that the overhead of recursion will not be a factor in your comparisons. In this case, iteration is recommended.

Use the following sets of increments:

1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524 (Knuth's sequence)

1, 5, 17, 53, 149, 373, 1123, 3371, 10111, 30341

1, 10, 30, 60, 120, 360, 1080, 3240, 9720, 29160

One or more sets of increments of your choice.

Please note that the increment sets will need to be supplemented if you use data sets larger than 29000. Use the sequences increment sets like you use Knuth's increments. Find the first value larger than the file. Move back two increments to find the starting increment. So in the third sequence, for a file of size 1200, you would use increments of 360, 120, 60, 30, 10, 1, in that order. You will have four different Shell sorts to run.

Heap Sort is a practical sort to know and is based on the concept of a heap. It has two phases: Build the heap and extract the elements in sorted order from the heap. Altogether, you will have five sorts.

Create input files of four sizes: 50, 500, 1000, 2000, and 5000 integers. For each size file, make three versions. On the first, use a randomly ordered data set. On the second, use the integers in reverse order. On the third, use the integers in normal ascending order. (You may use a random number generator or shuffle function to create the randomly ordered file. It is important to avoid too many duplicates. Keep them to about 1%). This means you have an input set of 15 files plus whatever you deem necessary and reasonable. Files are available in the course site if you want to copy them. Your data should be formatted so that each number is on a separate line with no leading blanks. There should be no blank lines in the file.

Each sort must be run against all the input files. This will give you at least 75 runs. For grading purposes, for each sort, generate output only from the files of size 50. You will have 15 sets of output to turn in for the size 50 files. Your code needs to print out the sorted values and the times for each of the Shell Sorts and the Heap Sort for each of the three orders for size 50.

Your program should access the system clock to get some time values for the different runs. The call to the clock should be placed as close as possible to the beginning and the end of each sort. If other code is included, it may have a large, fixed, cost, which would tend to drown out the differences between the runs, if any. Why take a chance! If you get too many zero time data values or any negative time values then you must fix the problem. One way is to use larger files than those specified. Another solution is to perform the sorting in a loop, N times, and calculates an average value. You would need to be careful to start over with unsorted data, each time through the loop.

Consider implementing a Straight Insertion Sort to compare with Shell Sort. Also, consider files of size 10,000 or additional random files - perhaps with 15-20% duplicates. Your write-up must include a table of the times obtained.

In developing this assignment, please keep in mind that you will be turning in your source code to be run against my input. This is in addition to the runs you will need to make for analysis purposes. It needs to print out the sorted values. It does not need to print the times, but the times should be printed in the sample runs you turn in.

Reference no: EM131607678

Questions Cloud

System usability in mind select a website : With the topics of web and system usability in mind select a website and list it. Then use the following topics; intuitive, design consistency
Evaluation that is distributed to internship supervisors : Write an final evaluation that is distributed to internship supervisors, conduct a self-evaluation of your own performance
List and explain briefly mean-median : 1. List and explain briefly mean, median, mode, and standard deviation. Give an example of when it each term could be used in a real-life situation.
Write later professional eternal grateful and gratitude : comforting me, she was truly concerned for me. She told me to make sure to get checked out because it was not normal
Distinct sorting algorithms : Compare the performance of two distinct sorting algorithms to obtain some appreciation for the parameters to be considered in selecting an appropriate sort.
Identify ethical dilemma or issues : Identify Ethical Dilemma or Issues. Identify the relevant ethical dilemma and issues in the case study.Summarize Your Ethical Model.
Leading-edge retailers : It has been said that the advantage that leading-edge retailers such as Amazon have over their competition isn't technology; it's their management.
Discuss various stages in the project life cycle : Discuss various stages in the project life cycle based on the type of IT organization structure you have seen
Design a network for this company to incorporate : Design a network for this company to incorporate a network server, printer and wireless network. Provide a security solution for them. What type of topology?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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