(Created page with "== bubble sort == * http://en.wikipedia.org/wiki/Bubble_sort procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i =...") |
Tag: sourceedit |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == |
+ | == Data Structure & Algorithm == |
+ | * 常用数据结构: 链表,栈,队列,集合, hash table, 树,堆,优先级队列,图。 |
||
− | * http://en.wikipedia.org/wiki/Bubble_sort |
||
+ | * 使用数据结构的三个原因: 效率,抽象,重用性 |
||
+ | == Sort == |
||
− | procedure bubbleSort( A : list of sortable items ) |
||
+ | * https://zh.wikipedia.org/wiki/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95 - 排序算法 from wikipedia |
||
− | n = length(A) |
||
− | repeat |
||
− | swapped = false |
||
− | for i = 1 to n-1 inclusive do |
||
− | /* if this pair is out of order */ |
||
− | if A[i-1] > A[i] then |
||
− | /* swap them and remember something changed */ |
||
− | swap( A[i-1], A[i] ) |
||
− | swapped = true |
||
− | end if |
||
− | end for |
||
− | until not swapped |
||
− | end procedure |
Latest revision as of 11:20, 29 November 2016
Data Structure & Algorithm[]
- 常用数据结构: 链表,栈,队列,集合, hash table, 树,堆,优先级队列,图。
- 使用数据结构的三个原因: 效率,抽象,重用性
Sort[]
- https://zh.wikipedia.org/wiki/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95 - 排序算法 from wikipedia