assignment_01_solution

# Assignment_01_soluti - CS1102S Data Structures and Algorithms Assignment 01 Algorithm Analysis Solution 1 Exercise 2.1 on page 50 Order the

This preview shows pages 1–2. Sign up to view the full content.

CS1102S Data Structures and Algorithms Assignment 01: Algorithm Analysis – Solution 1. Exercise 2.1 on page 50: Order the following functions by growth rate: N , N , N 1 . 5 , N 2 , N log N , N log log N , N log 2 N , N log( N 2 ), 2 /N , 2 N , 2 N/ 2 , 37, N 2 log N , N 3 . Indicate which functions grow at the same rate and show why this is the case. Answer: 2 /N < 37 < N < N < N log log N < N log N N log( N 2 ) < N log 2 N < N 1 . 5 < N 2 < N 2 log N < N 3 < 2 N/ 2 < 2 N (1) The only two functions that grow at the same rate are N log N and N log( N 2 ): N log( N 2 ) = 2 N log N = Θ( N log N ) (2) For all other functions, the ordering is strict. In particular the following functions do not grow at the same rate: 2 N/ 2 n = Θ(2 n ) , as: lim N →∞ 2 N/ 2 2 N = lim N →∞ 2 N/ 2 2 N/ 2 2 N/ 2 = lim N →∞ 1 2 N/ 2 = 0 (3) N log 2 N = N [log N ] 2 n = N log log N (4) N 1 . 5 n = Θ( N log 2 N ) , as lim N →∞ N 1 . 5 N log

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/09/2011 for the course CS 11025 taught by Professor Nil during the Spring '11 term at National University of Singapore.

### Page1 / 3

Assignment_01_soluti - CS1102S Data Structures and Algorithms Assignment 01 Algorithm Analysis Solution 1 Exercise 2.1 on page 50 Order the

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online