feat: add binary_insertion_sort (#1850)

* Add binary_insertion_sort.cpp

* Update binary_insertion_sort.cpp

* Update sorting/binary_insertion_sort.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update binary_insertion_sort.cpp

* Update binary_insertion_sort.cpp

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for d48126b7

* clang-format and clang-tidy fixes for 30cafcab

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
This commit is contained in:
Siddhartha Shankar Padhy
2022-01-12 00:09:41 +05:30
committed by GitHub
parent 5592f0449b
commit e6b17203c7
3 changed files with 152 additions and 4 deletions

View File

@@ -45,13 +45,14 @@ const std::vector<std::vector<std::string>> test_set = {
/** Main function */
int main() {
for (size_t i = 0; i < test_set.size(); i++) {
int output = brute_force(test_set[i][0], test_set[i][1]);
for (const auto &i : test_set) {
int output = brute_force(i[0], i[1]);
if (std::to_string(output) == test_set[i][2])
if (std::to_string(output) == i[2]) {
std::cout << "success\n";
else
} else {
std::cout << "failure\n";
}
}
return 0;
}