refactor: 去除无用测试代码

This commit is contained in:
LouisFonda 2024-02-24 15:18:51 +08:00
parent aed06b9ad5
commit 26e211c792

View File

@ -1,5 +1,9 @@
import { generateRandomArray, isSort } from "../util/index.mjs"; import { generateRandomArray, isSort } from "../util/index.mjs";
/**
* 插入排序
* @param {number[]} arr
*/
export function insertionSort(arr){ export function insertionSort(arr){
let n = arr.length; let n = arr.length;
for (let i = 1; i<n; i++) { for (let i = 1; i<n; i++) {
@ -12,8 +16,3 @@ export function insertionSort(arr){
arr[j+1] = currentElement arr[j+1] = currentElement
} }
} }
let arr = generateRandomArray(1000)
insertionSort(arr)
console.log(isSort(arr));