feat: 添加数组测试
This commit is contained in:
parent
6513a1e5be
commit
26c776c3f4
15
sort/test.mjs
Normal file
15
sort/test.mjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { generateRandomArray, measureTime, isSort } from "../util/index.mjs";
|
||||||
|
import { shellSort } from "./shell-sort.mjs";
|
||||||
|
import {insertionSort } from "./insertion-sort.mjs"
|
||||||
|
import { bubbleSort } from "./bubble-sort.mjs"
|
||||||
|
|
||||||
|
let arr = generateRandomArray(10000)
|
||||||
|
let arr2 = arr.slice()
|
||||||
|
let arr3 = arr.slice()
|
||||||
|
|
||||||
|
measureTime(bubbleSort,arr)
|
||||||
|
measureTime(insertionSort,arr2)
|
||||||
|
measureTime(shellSort,arr3)
|
||||||
|
console.log(isSort(arr));
|
||||||
|
console.log(isSort(arr2));
|
||||||
|
console.log(isSort(arr3));
|
Loading…
x
Reference in New Issue
Block a user