1
0
mirror of https://gitee.com/coder-xiaomo/algorithm-visualization synced 2025-09-08 05:31:38 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

添加插入排序算法;添加弹出弹回动画;动画参数放入全局settings变量中;添加debugMode全局变量

This commit is contained in:
2022-05-18 21:28:16 +08:00
parent 4e7a355e93
commit 8f4d77af6d
4 changed files with 176 additions and 25 deletions

View File

@@ -40,6 +40,7 @@ var sortAlgorithm = {
quicksort: new QuickSort(animation),
bubblesort: new BubbleSort(animation),
selectionSort: new SelectionSort(animation),
insertionSort: new InsertionSort(animation),
}
// 遍历每一种算法
@@ -51,7 +52,7 @@ Object.values(sortAlgorithm).forEach(sortAlgo => {
var input = JSON.parse(JSON.stringify(element))
// 进行排序
var result = sortAlgo.sort(input)
console.log(input, result)
console.log("before", element, "after", result)
// 与结果进行对比,判断是否正确
if (data.indexOf(element) > -1) {
var rightSortResult = check[data.indexOf(element)];