Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a. n, one for loop
- b. n^2, nested for loop
- c. log(n), as x is doubling every loop
- d. n^2, one for loop
- e. n
- a.
- b.
- c.
- d. n log(n), as j is doubling every loop
- e.
- a. log(n), reducing each loop amount
- b.
- c.
- d. n^3, as inner for loop runs n*n
- e. n^2, worst case scenario with nested for loops
- f. n^3, three loops running n times each
- g. n^2, nested for loop
- h. n times, as the n function is slower than logarithm
- i. n^4, as the nested loop is defined by i = n*n
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement