Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Problem1:
  2.  
  3. Prove that if f1(n) =O(g1(n)) and f2(n) =O(g2(n)) then f1(n) +f2(n) =O(g(n)) where g(n) = max(g1(n), g2(n)). Assume all functions are non-negative.
  4.  
  5. Given,
  6. f1(n) = O(g1(n)),
  7. f2(n) = O(g2(n))
  8.  
  9. Let g'(n) = f1(n) + f2(n)
  10.  
  11. and, g'(n) and O(g(n))
  12.  
  13. By the definition of O of a function, if g'(n) =O(g(n)), then cg(n) >= g'(n) for n greater than some n' and a positive constant c.
  14.  
  15. Clearly, O(g'(n)) is O(f1(n) + f2(n))
  16. Therefore, O(g'(n)) is O(g1(n)+g2(n))
  17.  
  18. Case1, if g1(n) = g2(n) then O(g'(n)) is O(2g1(n)); but by the definition of O, it should be trivially and without loss of generality, O(max(g1(n),(g2(n))).
  19.  
  20. Case2, we simply take O(max(g1(n), g2(n))) as O(g(n)) because at some point with certain values of n' and c, O(max(g1(n), g2(n))) will be true, by definition. Q.E.D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement