forked from zhaosaisai/sort.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
47 lines (43 loc) · 969 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const PAS = require('./sort.js')
var a = [1,2,3,5,6,3,1,4];
// console.log(PAS.bubble([1,2,3,5,6,3,1,4]))
//console.log(PAS.insert([1,2,3,5,6,3,1,4]))
//console.log(PAS.quick([1,2,3,5,6,3,1,4]))
//console.log(PAS.selection([1,2,3,5,6,3,1,4]))
//console.log(PAS.merge([1,2,3,5,6,3,1,4]))
//console.log(PAS.shell([1,2,3,5,6,3,1,4]))
//console.log(PAS.heap([1,2,3,5,6,3,1,4]))
//console.log(PAS.radix([1,2,3,5,6,3,1,4]))
//console.log(PAS.bucket([1,2,3,5,6,3,1,4]))
//console.log(PAS.count([1,2,3,5,6,3,1,4]))
// console.log(a.insert())
[
'bubble',
'insert',
'quick',
'selection',
'merge',
'shell',
'heap',
'radix',
'bucket',
'count'
].forEach(function(func) {
var arr = [1,2,3,5,6,3,1,4];
console.log(PAS[func](arr), func)
});
[
'bubble',
'insert',
'quick',
'selection',
'merge',
'shell',
'heap',
'radix',
'bucket',
'count'
].forEach(function(func) {
var arr = [1,2,3,5,6,3,1,4];
console.log(arr[func](), func)
})