CSC 3102 — Advanced Data Structures & Algorithm Analysis

Homework 1

Due: In class, on paper, Tuesday 20 September 2016. Typed submissions receive extra credit.

  1. (5 points) The number of operations executed by algorithms A and B is \(40 n^2\) and \(2 n^3\), respectively. Determine \(n_0\) such that A is better than B for \(n > n_0\).

  2. (5 points) Show that \((n + 1)^5\) is \(O(n^5)\).

  3. (5 points) Show that \(n^2\) is \(\Omega(n\log n)\).

  4. (10 points) Show that if \(d(n)\) is \(O(e(n))\) and \(f(n)\) is \(O(g(n))\), then \(d(n) + f(n)\) is \(O(e(n) + g(n))\).

  5. (10 points) For each of the following, either prove the statement true or give a counterexample \(n\) if false.

  6. (10 points) Determine the Big-\(O\) bound of the following code, given input size \(n\).

      for (\(i\gets 1\); \(i\leq n\); \(i\gets 2\ i\))
       for (\(j\gets 1\); \(j\leq i\); \(j\gets j + 1\))
        print \(A[j]\)

  7. (10 points) Arrange the following functions in non-decreasing order. Specifically, if \(i\lt j\) then \(f_i\) is \(O(f_j)\). There’s no need to show proof of the ordering.