23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

R-4.22<br />

Show that if d(n) is O(f(n)) <strong>and</strong> e(n) is O(g(n)), then d(n) + e(n) is O(f(n) +<br />

g(n)).<br />

R-4.23<br />

Show that if d(n) is O(f(n)) <strong>and</strong> e(n) is O(g(n)), then d(n) − e(n) is not<br />

necessarily O( f(n) − g(n)).<br />

R-4.24<br />

Show that if d(n) is O(f(n)) <strong>and</strong> f(n) is O(g(n)), then d(n) is O(g(n)).<br />

R-4.25<br />

Show that O(max{f(n),g(n)}) = O(f(n) + g(n)).<br />

R-4.26<br />

Show that f(n) is O(g(n)) if <strong>and</strong> only if g(n) is Ω(f(n)).<br />

R-4.27<br />

Show that if p(n) is a polynomial <strong>in</strong> n, then log p(n) is O(logn).<br />

R-4.28<br />

Show that (n + 1) 5 is O(n 5 ).<br />

Code Fragment 4.5: Some algorithms.<br />

251

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!