Algorithms
Classified in Computers
Written at on English with a size of 1.86 KB.
1.A) f(n) = 10 n^2 log (n^10) + n log (n^5) => o(n^2) || 1.B) f(n) = 2^100 n^4 + n^3 => o (n^4)
2.A) 2 nested for inside for => n [n+n] = 2n^2
2.B) no. Of primitive operations (1 comparison & 1 return tot=2), 1 for println, (1 for division & 1 for recursive call) => running time is o(n)
2.C) Assignment 1, comparison 1, division 1 & assignment 1 tot=2, addition 1 & assignment 1 tot= 2 (while n), return 1 => running time o(n)
3.A) c2g(n) above f(n) and c1g(n) under f(n)
for constant c1 and no f(n) is omega (g(n)) for every n>=no || for constant c2 and no f(n) is O(g(n)) for every n>=no then f(n) = theta (g(n))
3.B) cg(n) above f(n)
for constant c and no f(n)= O(g(n))
3.C) cg(n) under f(n)
for constant c... Continue reading "Algorithms" »