-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
33 lines (30 loc) · 825 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <vector>
#include <iostream>
#include <string>
#include "utils/search.hpp"
using namespace std;
int main() {
vector < int > arr = {4, 4, 6, 2, 6, 7, 3, 1, 7, 8};
Search search_utils("quick", "binary");
int target;
string def = "[ ";
for (int elem: arr) {
def += to_string(elem);
def += " ";
}
def += "]";
cout << "Current array: " << def << endl;
cout << "Target: ";
cin >> target;
int result = search_utils.search(arr, target);
string sorted = "[ ";
for (int elem: search_utils.sorted_arr) {
sorted += to_string(elem);
sorted += " ";
}
sorted += "]";
cout << "Sorted array: " << sorted << endl;
cout << "Searing element: " << target << endl;
cout << "It's result (index): " << result << endl;
return 0;
}