1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-24 10:39:50 +08:00

feat: 更新文档

This commit is contained in:
最近在学桌球
2023-08-30 17:04:20 +08:00
parent 952946ad38
commit 6a1567cd2e
34 changed files with 64 additions and 431 deletions

View File

@@ -1,13 +1,8 @@
/*
* @Description: 冒泡排序【JavaScript版本】
* @Version: Beta1.0
* @Author: 【B站&公众号】Rong姐姐好可爱
* @Date: 2021-04-06 07:26:59
* @LastEditors: 【B站&公众号】Rong姐姐好可爱
* @LastEditTime: 2021-04-06 08:01:19
/**
* 冒泡排序【JavaScript版本】
*/
function BubbleSort(arr, len) {
// 校正数组的长度
len = arr.length === len ? len : arr.length
@@ -38,20 +33,6 @@ function BubbleSort(arr, len) {
return arr
}
/**
* 加减法交换元素的值
* 注意JavaScript中使用需要考虑到作用域的问题
* @param a
* @param b
*/
function swap(a, b) {
a = a + b
b = a - b
a = a - b
}
const initArr = [1, 5, 8, 3, 2, 9, 16]
console.log(`冒泡排序前:${initArr}`)
const sortedArr = BubbleSort(initArr, 7)