John Mavrick's Garden

Search IconIcon to open search

Last updated April 10, 2022

Status:: #literature/books/ Author:: Medium:: { Books MOC Tags:: Links: { Cracking the Coding Interview Application


{ Cracking the Coding Interview

Big O

Answers

  1. O(b), condition for for loop
  2. O(b), b is decremented by 1 and base case is b=0
  3. O(1)
  4. O($log_ab$)
    • O(a/b)
  5. O(logn) cuz its like binary search
  6. O(sqrt n) worst case is not perfect, will go 1,4,… which increases by sqrt
  7. O(n)
  8. O(n)
  9. O(n) because it has to go through all ements of old array
    • O($n^2$)
  10. O(s) where s is length of string
    • O($log_{10}n$)
  11. O(s), size of string
  12. O(nlogn)
    • O(b logb + a logb)

Backlinks



References:

Created:: 2022-03-29 23:03


Interactive Graph