Skip to content

Commit 81d909a

Browse files
committed
revise array1d,2d and add insertion sort
1 parent b224af5 commit 81d909a

File tree

342 files changed

+479
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+479
-459
lines changed
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
for (var j = 1; j < D.length; j++) {
2-
var key = D[j];
3-
tracer._select(j);
4-
for (var i = j - 1; (i >= 0) && (D[i] < key); i--) {
5-
D[i + 1] = D[i];
1+
tracer._print('original array = [' + D.join(', ') + ']');
2+
tracer._sleep(1000);
3+
tracer._pace(300);
4+
for (var i = 1; i < D.length; i++) {
5+
var key = D[i];
6+
tracer._print('insert ' + key);
7+
tracer._select(i);
8+
var j;
9+
for (j = i - 1; (j >= 0) && (D[j] > key); j--) {
10+
D[j + 1] = D[j];
11+
tracer._notify(j + 1);
612
}
7-
D[i + 1] = key;
8-
tracer._change(j);
9-
}
13+
D[j + 1] = key;
14+
tracer._notify(j + 1);
15+
tracer._deselect(i);
16+
}
17+
tracer._print('sorted array = [' + D.join(', ') + ']');

css/stylesheet.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ section {
136136
bottom: 50%;
137137
left: 0;
138138
right: 0;
139-
text-align: center;
140139
}
141140

142141
.tab_container {
@@ -250,4 +249,12 @@ pre {
250249
vertical-align: middle;
251250
text-align: center;
252251
background: #888;
252+
}
253+
254+
.mtbl-cell.selected {
255+
background: #00f;
256+
}
257+
258+
.mtbl-cell.notifying {
259+
background: #f00;
253260
}

js/ace/ace.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/ace/ext-beautify.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)