diff_months: 15

"Big-Oh" notation -recurrences to analyse algorithm performance Assignment

Download Solution Now
Added on: 2023-02-20 13:30:29
Order Code: eqb5 20-2-23
Question Task Id: 0
  • Country :

    Australia

1.  You have developed a divide-and-conquer algorithm and found that its running time T (n) for n data items is described by the following recurrence relation:

T (n) = k.T (n/k) + c.k.n; T (1) = 0:

Use a telescoping technique to and a closed form formula for T (n) in terms of c, n, and k. What is the computational complexity of this algorithm in a \Big-Oh" sense? Explain using the derived formula.
Hint : To have the recurrence well-defined, assume that n = km with the variable integer m and constant integer k (note that m = logk n).

2. What value of k = 2, 3, or 4 should you choose to get the fastest processing?
Hint : note that logk n = ln n/In k

ln k where ln denotes a natural logarithm (with the base e = 2:71828 :::).

3.  Suppose you are a programmer in a big company which constantly needs to process very big data bases, containing each up to n = 109 records. Your manager asks you to suggest which one of the two software packages, A or B, of the price $10,000 and $20,000, respectively, should be bought to ensure the fastest processing. You have analysed processing algorithms implemented in the packages A and B and you have found that they are of the \Big-Oh" complexity O(n log n) and O(n), respectively. But you are not going
to recommend your manager to choose the package B before you conduct your own tests. You have found that the average time of processing n = 104 data items with the package A is 100 milliseconds and with the package B is 500 milliseconds. Work out exact conditions (in terms of the database size n) when one package actually outperforms the other one and recommend the best choice to your manager.

4.  Work out the computational complexity of the following piece of code assuming that
n = 2m :

for( int i = n; i > 0; i-- ) {
for( int j = 1; j < n xss=removed> for( int k = 0; k < j> ... // constant number C of operations with i, j, k
}
}
}

5.  Write a program benchmark.java that performs a series of benchmarking tests to see which sorting method, mergeSort, heapSort, or quickSort, is faster. The methods are given in the COMPSCI.220FT coursebook (Chapter 1, Section 1.2) and can be downloaded from the course web page (\Lectures", Part 1: Georgy's lecture notes). But you may choose any other available implementation.

Your tests should include arrays of very \random" integers in the range [0 ::: 1; 000; 000]. The size ntest of array should be an input parameter of your program, and you have to choose an appropriate size of the array for testing all three methods on the available PCs such that the average time of sorting one array of the chosen size was about 0.05 - 0.1 second.

The program should repeat sorting several times (with different randomly filled arrays of the same size ntest) in order to find and output for each method the average time, the standard deviation, and the range of the sorting time.

Let k denote the serial number of a test. Let K be the total number of the tests. Let Tsort;k be the sorting time for the test k using a particular sort. Then the average time Aps, standard deviation Sps, and the range of the time [Tps;min; Tps;max] are computed as follows.

To fill arrays, you may use the random generator java.lang.Math.random(). It provides double output values that you should convert into integers in the range [0 ::: 1; 000; 000].
To measure processing time you can use the System.currentTimeMillis() method, for instance,

long start = System.currentTimeMillis();
sortingMethod( arrayToSort );
long runTime = System.currentTimeMillis() - start;

6. Using the above array size ntest and average times of its sorting with mergesort, heapsort, and quicksort, fAps : ps = mergesort, heapsort, quicksortg, derive explicit formulas for computing the expected average time of sorting an array of a given size by each method. Compare the expected values to the experimental results obtained by running the program benchmark.java for the array of the size n = 2 ntest.

Get your "Big-Oh" notation and basic recurrences to analyse algorithm performance assignment solved by our Computer Science Experts from Exam Question Bank . Our Assignment Writing Experts are efficient to provide a fresh solution to all question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing Style. Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered.

You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turn tin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

  • Uploaded By : Katthy Wills
  • Posted on : February 20th, 2023
  • Downloads : 0
  • Views : 266

Download Solution Now

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more