记录一些算法

常见算法的复杂度:

<The progmatic programmer> 中对算法的讲义是简洁的。特别是:

O() notation

  • O(1) access element in array; Hash
  • O(lgn) binary search, traveling a binary tree
  • O(n) exhaustive search, finding the max
  • O(nlogn) divide and conqure, quick sort/heapsort
  • O(n^2) selection and insertion sorts. bubble sort
  • O(c^n) traveling salesman problem, set partitioning,permutations
原文地址:https://www.cnblogs.com/leby/p/4900330.html