Skip to content

Commit ea28138

Browse files
authored
Update Dutch_National_Flag_(DNF)_Algo.md
1 parent 29a4a0a commit ea28138

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/others/Dutch_National_Flag_(DNF)_Algo.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ The Dutch National Flag algorithm provides an efficient and elegant solution to
3030

3131
![image](https://github.com/shimmer12/cp-algorithms/assets/92056170/fc9dc112-5d36-42f2-bb06-4347a371e00c)
3232

33+
$$\begin{array}{ccccccccccc}
34+
0 & 0 & 1 & 1 & 1 & ? & \dots & ? & 2 & 2 & 2 \\
35+
& & \uparrow & & & \uparrow && \uparrow && \\
36+
& & \text{low} & & & \text{mid} & & \text{high} & & &
37+
\end{array}$$
38+
3339

3440
```cpp
3541
#include <vector>
@@ -61,3 +67,7 @@ The Dutch National Flag algorithm operates with O(N) time complexity, where N is
6167
In summary, the Dutch National Flag algorithm is a valuable tool for efficiently sorting an array with three distinct elements while minimizing time and space complexity. Understanding the thought process and intuition behind this algorithm can be a great advantage in interviews, competitive programming, and real-world applications where sorting three distinct values is a common requirement.
6268
6369
---
70+
---
71+
tags:
72+
- Original
73+
---

0 commit comments

Comments
 (0)