You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you've programmed your algorithm, you just need to create a 'AlgorithmVisualizer' value in your main class like this:
16
+
If you've programmed your algorithm, you just need to create a 'AlgorithmVisualizer' instance in your main class like this:
17
17
```
18
18
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer();
19
19
```
@@ -23,6 +23,21 @@ Now you need to call your method and pass the array as parameter, like this for
23
23
bubblesort(algorithmVisualizer.getArray());
24
24
```
25
25
26
+
#### Other constructors
27
+
```
28
+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(BarColor barColor);
29
+
```
30
+
```
31
+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(int size);
32
+
```
33
+
```
34
+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(int size, BarColor barColor);
35
+
```
36
+
37
+
## BarColor
38
+
You can change the bar colors by passing the 'BarColor' to the constructor, like explained above. These are the available colors:
39
+
##### BarColor.RED, BarColor.GREEN, BarColor.BLUE
40
+
26
41
## Animation
27
42
Now you actually 'connected' your algorithm with the library, but you actually should add a 'delay' after every operation in your algorithm, because otherwise your algorithm would be sorted instantly.
28
43
@@ -32,6 +47,21 @@ Thread.sleep(30);
32
47
```
33
48
whenever your values are changing. I would recommend a value between 10-25.
0 commit comments