Update dnf-sort.cpp
parent
c63ec9ee47
commit
cb36b08146
|
@ -1,3 +1,8 @@
|
|||
|
||||
// C++ program to sort an array
|
||||
// with 0, 1 and 2 using dnf sort which also stands for “Dutch National Flag algorithm”
|
||||
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
|
@ -53,3 +58,7 @@ int main()
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Time Complexity: O(n), Only one traversal of the array is needed.
|
||||
// Space Complexity: O(1), No extra space is required.
|
||||
|
|
Loading…
Reference in New Issue