Skip to content

Instantly share code, notes, and snippets.

View cybertxt's full-sized avatar
🙈

cybertxt cybertxt

🙈
View GitHub Profile
@fanfeilong
fanfeilong / datastruct and algorithm.md
Last active October 28, 2017 14:31
datastruct and algorithm

基本算法

  • 排序
    • 穩定的
      • 冒泡排序(bubble sort)-O(n^2)
      • 鸡尾酒排序(cocktail sort, 雙向的冒泡排序)-O(n^2)
      • 插入排序(insertion sort)-O(n^2)
      • 桶排序(bucket sort)-O(n);需要O(k)額外空間
      • 计数排序(counting sort)-O(n+k);需要O(n+k)額外空間
      • 归并排序(merge sort)-O(n*\log_{n});需要O(n)額外空間
  • 原地归并排序- O(n^2)