[Solved] CH08-320201-Homework 1 Asymptotic Analysis and Selection Sort

Click And Check all our Assignments
Click Here and Upload you Assignment for Free!

INSTANT DOWNLOAD!

100/100 Trustscore on scamadviser.com

10 USD $

Category: Tag:

Problem 1: Asymptotic Analysis

Considering the following pairs of functions f and g, show for each pair whether f ∈ Θ(g), f O(g), f o(g), f ∈ Ω(g), f ω(g), g∈ Θ(f), gO(f), go(f), g∈ Ω(f), or gω(f).

  • f(n) = 3n and g(n) = n3.

  • f(n) = 7n0.7 + 2n0.2 + 13logn and g(n) = n.
  • f(n) = n2/logn and g(n) = nlogn.
  • f(n) = (log(3n))3 and g(n) = 9logn.

Problem 2: Selection Sort

In class, we discussed Insertion Sort. Selection Sort is similar to Insertion Sort and works as follows. Given an array of elements, you always take the current element and exchange it with the smallest element that can be found on the right hand side of the current element. In doing so, you will gradually build up a sorted list on the left side (just as in Insertion Sort), and in each iteration “attach” the smallest element from the remaining unsorted right side to it.

  • Implement Selection Sort.
  • Show that Selection Sort is correct (consider the loop invariant).
  • Generate random input sequences of length n as well as sequences of length n that represent the worst case and the best case for the Selection Sort algorithm. Briefly describe how you generated the sequences (e.g. programmatically with a random sequence generator).
  • Run the algorithm on sequences of (c) with length n for increasing values of n and measure the computation times. Plot curves that show the computation time of the algorithm in the best, average, and worst case for increasing input length n. Note that in order to compute reliable measurements for the average case, you have to run the algorithm multiple times for each entry in your plot. You can use whatever plotting method you like (R, Matlab, Excel, by hand, …).
  • Interpret the plots in (d) with respect to asymptotic behavior and constants.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CH08-320201-Homework 1 Asymptotic Analysis and Selection Sort
10 USD $