Skip to content

Latest commit

 

History

History
11 lines (10 loc) · 702 Bytes

big-O.md

File metadata and controls

11 lines (10 loc) · 702 Bytes

Big O

big O cheatsheet

  • O(1) Constant # Odd or Even number, # Look-up table (on average)
  • O(log n) Logarithmic # Finding element on sorted array with binary search
  • O(n) Linear # Find max element in unsorted array, # Duplicate elements in array with Hash Map
  • O(n log n) Linearithmic # Sorting elements in array with merge sort
  • O(n^2) Quadratic # Duplicate elements in array (naïve),# Sorting array with bubble sort
  • O(n^3) Cubic # 3 variables equation solverO(2n)Exponential # Find all subsets
  • O(n!) Factorial # Find all permutations of a given set/string