Skip to content

Commit

Permalink
tested with an actual sorting algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Spa-ce42 committed Aug 26, 2023
1 parent 506328a commit 988554b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ else if (get(k) >= q)
return new int[] { j, g };
}

private final int MAX_VALUE = 1 << 24;

@Override
public void init(SVConfiguration svConfig) {
svConfig.setWidth(1280);
svConfig.setHeight(720);
svConfig.setMaxColoredBars((1 << 14) / 100);
svConfig.setUpdateInterval(2);
svConfig.setMaxColoredBars(MAX_VALUE / 500);
svConfig.setUpdateInterval(256000);
svConfig.setAutoColor(false);
}

@Override
public void run() {
final int MAX_VALUE = 1 << 14;
int[] a = new int[MAX_VALUE];

for(int i = 0; i < MAX_VALUE; ++i) {
Expand All @@ -83,7 +85,6 @@ public void run() {
array(a);
delay(1000);
Random r = new Random();

for(int i = 0, n = length(); i < n; ++i) {
int j = r.nextInt(i, n);
swap(i, j);
Expand All @@ -94,7 +95,6 @@ public void run() {
forceUpdate();

delay(1000);
setAutoColor(true);
dualPivotQuickSort(0, length() - 1);
clearColor();
forceUpdate();
Expand Down
16 changes: 16 additions & 0 deletions test/Small.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import com.kennethfei.sorting_visualizer.SV;

public class Small extends SV {
@Override
public void run() {
int[] a = new int[128];
for(int i = 0; i < a.length; ++i) {
a[i] = i * i;
}
array(a);
}

public static void main(String[] args) {
launch();
}
}

0 comments on commit 988554b

Please sign in to comment.