Update dnf-sort.cpp

pull/1124/head
Ansh Tripathi 2023-01-01 18:16:58 +05:30 committed by GitHub
parent c63ec9ee47
commit cb36b08146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 10 deletions

View File

@ -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.