Skip to content

Commit d832267

Browse files
committed
Finally done
1 parent 5d4da49 commit d832267

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

SortingAssignment.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class SortingAssignment extends JFrame implements Runnable { //Hack for g
1212
private JComponent cntrls[];
1313

1414
public static void main(String[] args) throws Exception {
15+
System.setProperty("sun.java2d.opengl", "true");
1516
new Thread(null, new SortingAssignment(), "SortingAssignment", 1<<26).start(); //Increase the stack
1617
}
1718

@@ -174,10 +175,6 @@ private void quicksort() throws InterruptedException {
174175
synchronized (rect) {
175176
rect[i].setComparing(false);
176177
pivot.setComparing(false);
177-
}
178-
repaint();
179-
Thread.sleep(DELAY);
180-
synchronized (rect) {
181178
if (rect[i].compareTo(pivot) <= 0) {
182179
Bar tmp = rect[++prt];
183180
rect[prt] = rect[i];
@@ -193,8 +190,8 @@ private void quicksort() throws InterruptedException {
193190
}
194191
repaint();
195192
//Recursively quicksort
196-
S.push(new Pair(lft, prt - 1));
197193
S.push(new Pair(prt + 1, rht));
194+
S.push(new Pair(lft, prt - 1));
198195
}
199196
}
200197
repaint();
@@ -220,10 +217,6 @@ private void timsort() throws InterruptedException {
220217
synchronized (rect) {
221218
prevE.setComparing(false);
222219
rect[i].setComparing(false);
223-
}
224-
repaint();
225-
Thread.sleep(DELAY);
226-
synchronized (rect) {
227220
if (prevE.compareTo(rect[i]) <= 0) {
228221
prevE = rect[i];
229222
} else {
@@ -265,10 +258,6 @@ else if (j > P2.second)
265258
synchronized (rect) {
266259
rect[i].setComparing(false);
267260
rect[j].setComparing(false);
268-
}
269-
repaint();
270-
Thread.sleep(DELAY);
271-
synchronized (rect) {
272261
if (rect[i].compareTo(rect[j]) <= 0)
273262
tmp[k++] = rect[i++];
274263
else
@@ -284,6 +273,7 @@ else if (j > P2.second)
284273
repaint();
285274
Q.offer(new Pair(P1.first, P2.second));
286275
}
276+
repaint();
287277
}
288278
}
289279

0 commit comments

Comments
 (0)