SuperTutor

(15)

$15/per page/Negotiable

About SuperTutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,Engineering,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 233 Weeks Ago
Questions Answered: 12843
Tutorials Posted: 12834

Education

  • MBA, Ph.D in Management
    Harvard university
    Feb-1997 - Aug-2003

Experience

  • Professor
    Strayer University
    Jan-2007 - Present

Category > Programming Posted 18 May 2017 My Price 8.00

COMPCOUNT

This programming assignment is to implement the following three sorting algorithms and to collect time performance measurements on them.

1. Mergesort, 2. Heapsort, 3. Quicksort.

The running time of each sorting algorithm must be measured in two ways:

  • Count the number of key comparisons, COMPCOUNT. To obtain this count, it is suggeted that you write a function COMPARE(X,Y), which will perform a comparison between X and Y and increment COMPCOUNT. Then, wherever you need to perform a key comparison in your algorithms, you simply make a call to this function.
  • Use the actual measured CLOCK time. You need to carry out the experiment in two parts.

1 A small array size, n = 32, to verify correctness

Run each algorithm on three sets of data:

(1) Sorted; (2) Reversely sorted; and (3) Randomly generated.

For simplicity, you may use integers. For each case, make sure the same original data is input to all three algorithms. Print both the sorted array and measured number of comparisons for each case to show the correctness of your algorithms.

2 Large array sizes to determine time complexity

Run each sorting algorithm on the following array sizes:

• n=210 =1,024
• n=215 =32,768
• n = 220 = 1,048,576

For each value of n, produce an array of n randomly generated elements only once. (For simplicity, you may use integers.) Again, make sure you provide the same randomly-generated array of data to all three sorting algorithms.

Tabulate the performace results, listing both the number of comparisons and the measured clock times. Use the tabulated number of comparisons to determine the time complexity. For example, does the data for quicksort verify O(n2) or O(nlogn) time, and what is the constant factor? Note that since you use a random sequence to sort, the running times should correspond to the average-case time complexities.

 

Answers

(15)
Status NEW Posted 18 May 2017 02:05 AM My Price 8.00

-----------

Attachments

file 1495074948-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)