hw1 - the input value n ) Read(n) i=1 ; s=1 ; while( s n )...

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

View Full Document Right Arrow Icon
Cs445 — Homework #1 Asymptotic running time and recursions formulas Due Time: 2/15/05 1. Assume f 1 ( n ) = O ( g 1 ( n )) and f 2 ( n ) = O ( g 2 ( n )). Prove or disprove: (a) f 1 ( n ) + f 2 ( n ) = O ( g 1 ( n ) + g 2 ( n )) (b) f 1 ( n ) * f 2 ( n ) = O ( g 1 ( n ) * g 2 ( n )) (c) f 1 ( n ) f 2 ( n ) = O ( g 1 ( n ) g 2 ( n ) ) 2. Assume you are given an infnite sequances oF Functions f 1 ( n ) , f 2 ( n ) . . . . Assume that it is known that f i ( n ) = O ( n 2 ) For i = 1 , 2 , 3 ... We defne a new Function g ( n ) = n i =1 f i ( n ). Is it true that g ( n ) = O ( n 3 ) ? 3. Prove Formally that log 2 n = Θ(log 10 n ) 4. Prove that n i =1 log i = Θ( n log n ) 5. What is the running time oF the Following Function (specifed as a Function oF
Background image of page 1

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

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

Unformatted text preview: the input value n ) Read(n) i=1 ; s=1 ; while( s n ) { i++ ; s= s+i ; print(*); } 1 6. Write a recursive function for the running time T ( n ) of the function NoNeed , whose code is below. Prove using the iterative method that T ( n ) = ( n 3 ). NoNeed ( int n ) { if ( n 1 ) return ; for( i = 1 ; i n ; i + + ) for( j = 1 ; j n ; j + + ) print(* ) ; NoNeed ( n-3 ) }...
View Full Document

Page1 / 2

hw1 - the input value n ) Read(n) i=1 ; s=1 ; while( s n )...

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