File tree 1 file changed +7
-7
lines changed
src/main/java/com/thealgorithms/misc
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .Scanner ;
4
4
5
5
/**
6
- * The array is divided into four sections:
7
- * a[1..Lo-1] zeroes
8
- * a[Lo..Mid-1] ones
9
- * a[Mid..Hi] unknown
10
- * a[Hi+1..N] twos
11
- *
6
+ * The array is divided into four sections:
7
+ * a[1..Lo-1] zeroes
8
+ * a[Lo..Mid-1] ones
9
+ * a[Mid..Hi] unknown
10
+ * a[Hi+1..N] twos
11
+ *
12
12
* If array [mid] = 0, then swap array [mid] with array [low] and increment both pointers once.
13
13
* If array [mid] = 1, then no swapping is required. Increment mid pointer once.
14
14
* If array [mid] = 2, then we swap array [mid] with array [high] and decrement the high pointer once.
15
- *
15
+ *
16
16
* For more information on the Dutch national flag algorithm refer
17
17
* https://en.wikipedia.org/wiki/Dutch_national_flag_problem
18
18
*/
You can’t perform that action at this time.
0 commit comments