mirror of
https://gitee.com/coder-xiaomo/algorithm-visualization
synced 2025-09-08 05:31:38 +08:00
添加插入排序算法;添加弹出弹回动画;动画参数放入全局settings变量中;添加debugMode全局变量
This commit is contained in:
@@ -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)];
|
||||
|
Reference in New Issue
Block a user