HW1 - CS 521 Data Structures and Algorithms 1 Fall 2009-2010 Homework 1 1(20 Pts Rank the following functions by order of growth that is nd an

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

View Full Document Right Arrow Icon
CS 521: Data Structures and Algorithms 1 Fall 2009-2010 Homework 1 1. (20 Pts) Rank the following functions by order of growth; that is, find an arrangement g 1 , g 2 , . . . , g 25 of the functions satisfying g 1 = Ω( g 2 ) , g 2 = Ω( g 3 ) , ..., g 24 = Ω( g 25 ). Partition your list into equiva- lence classes such that f ( n ) and g ( n ) are in the same class if and only if f ( n ) = θ ( g ( n )): (3 / 2) n ( 2) log n log * n n 2 (log n )! n 3 log 2 n log n ! 2 2 n n 1 / log n log log n n. 2 n n log log n ln n 2 n 2 log n (log n ) log n 4 log n ( n + 1)! log n n ! 2 2 log n n n log n n 100 2. (20 Pts) Compute the running time of the following algorithms (justify your answers). We may assume multiplication and computing sqrt(n) takes constant time. (a) Algorithm veryodd(n) for i= 1 to n if odd(i) then begin for j=i to n do x<--x+1 for j=1 to i do y<--y+1 endif endfor end algorithm ______________________________________ (b) Algorithm what(n) for i= 1 to floor( sqrt(n) ) do for j= floor( sqrt(n) ) downto 1 do
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/24/2009.

Page1 / 2

HW1 - CS 521 Data Structures and Algorithms 1 Fall 2009-2010 Homework 1 1(20 Pts Rank the following functions by order of growth that is nd an

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online