Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. a. n, one for loop
  2. b. n^2, nested for loop
  3. c. log(n), as x is doubling every loop
  4. d. n^2, one for loop
  5. e. n
  6.  
  7. a.
  8. b.
  9. c.
  10. d. n log(n), as j is doubling every loop
  11. e.
  12.  
  13. a. log(n), reducing each loop amount
  14. b.
  15. c.
  16. d. n^3, as inner for loop runs n*n
  17. e. n^2, worst case scenario with nested for loops
  18. f. n^3, three loops running n times each
  19. g. n^2, nested for loop
  20. h. n times, as the n function is slower than logarithm
  21. i. n^4, as the nested loop is defined by i = n*n
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement