File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 4444* [ 06-03] ( https://github.com/TYRMars/JSlearn#06-03 ) ` 模块化-CommonJS `
4545#### 07
4646* [ 07-01] ( https://github.com/TYRMars/JSlearn#07-01 ) ` 上线回滚-上线回滚流程 `
47-
47+ #### 08 JS算法
48+ * [ 08-01] ( https://github.com/TYRMars/JSlearn#08-01 ) ` 排序算法 `
4849
4950---
5051
@@ -1576,6 +1577,34 @@ module.exports = {
15761577* 测试环境要匹配线上环境,因此也是Linux
15771578* 经常需要登陆测试机来自己配置、获取数据
15781579
1580+ ## 08 - 01
1581+ ### 排序算法
1582+ 1. 冒泡排序
1583+
1584+ ` ` ` JavaScript
1585+ function bubbleSort(arr){
1586+ var i = 0,
1587+ j = 0;
1588+ for (var i = 0; i < array.length; i++) {
1589+ var temp = 0;
1590+ //">"从小到大
1591+ //"<"从大到小
1592+ if (arr[i] > arr[j+1]) {
1593+ temp = arr[j];
1594+ arr[j] = arr[j+1];
1595+ arr[j+1] = temp;
1596+ }
1597+ }
1598+ return arr;
1599+ }
1600+ ` ` `
1601+
1602+ 2. 快速排序
1603+
1604+ ` ` ` JavaScript
1605+
1606+ ` ` `
1607+
15791608-- -
15801609
15811610### JSDemo JS 小程序
You can’t perform that action at this time.
0 commit comments