Status:: #literature/books/ Author:: Medium:: { Books MOC Tags:: Links: { Cracking the Coding Interview Application
{ Cracking the Coding Interview
Big O
Answers
- O(b), condition for for loop
- O(b), b is decremented by 1 and base case is b=0
- O(1)
- O($log_ab$)
- O(a/b)
- O(logn) cuz its like binary search
- O(sqrt n) worst case is not perfect, will go 1,4,… which increases by sqrt
- O(n)
- O(n)
- O(n) because it has to go through all ements of old array
- O($n^2$)
- O(s) where s is length of string
- O($log_{10}n$)
- O(s), size of string
- O(nlogn)
- O(b logb + a logb)
Backlinks
|
|
References:
Created:: 2022-03-29 23:03