CSC 344 - Algorithms and Complexity

Dr R. M. Siegfried

Assignment #2 - Working with Asymptotic Notation

Due Wednesday, February 1, 2017

  1. Select a theta (Θ) notation for each expression:
    1. 6n + 1
    2. 6n3 + 12n2 + 1
    3. 3n2 + 2n lg n
    4. 2 lg n + 4n + 3n lg n
    5. (n2 + lg n)(n + 1)/(n + n2)
  2. Select the theta notation for these code fragments (the choices are Θ(1), Θ(lg n), Θ(n), Θ(n lg n), Θ(n2), Θ(n3), Θ(2n), and Θ(n!)):
    1. for i = 1 to 2n
        x = x + 1
      
    2. for i = 1 to 2n
        for j = 1 to i
          x = x + 1
      
    3. for i = 1 to n
        for j = 1 to i
          for k = 1 to i
            x = x + 1
      
    4. i = n
      while (i ≥ 1) {
        x = x + 1
        i = i / 2
      }
        

[Back to the Assignments Page]