repo.or.cz
/
chromium-blink-merge.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Only sync parent directory once after a leveldb file rename.
[chromium-blink-merge.git]
/
webkit
/
data
/
test_shell
/
sort
/
sort-bubble.js
blob
dc084ba7cf9bcd6f96f2eccfc0c6e42bc3362747
1
// bubble sort
2
3
function sort_bubble(sort, x, y) {
4
if (arguments.length == 1) {
5
x = 1; y = 0;
6
}
7
var len = sort.bars.length;
8
if (x < len && y < len) {
9
if (sort.compare(x, y) < 0) {
10
sort.swap(x, y);
11
}
12
y++;
13
if (y == x) {
14
y = 0;
15
x++;
16
}
17
if (x < len) {
18
sort.add_work(function() { sort_bubble(sort, x, y); });
19
return;
20
}
21
}
22
}
23