Skip to content

Commit

Permalink
6 yes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andeo1812 committed Apr 19, 2022
1 parent e52b2b8 commit 71436ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

5 - 3 - YES

6 - 2
6 - 2 - YES

7 - 3

Expand Down
9 changes: 5 additions & 4 deletions module_1/6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ int partition(T *array, int left, int right, CompareRule rule = Less<T>()) {
}

template<typename T, class CompareRule = Less<T>>
T find_k_statistics(T *array, int left, int right, int target, CompareRule rule = Less<T>()) {
T find_k_statistics(T *array, int right, int target, CompareRule rule = Less<T>()) {
srand(time(NULL));

int left = 0;
while (true) {
int pos_pivot = partition(array, left, right, rule);
if (pos_pivot == target) {
Expand All @@ -115,9 +116,9 @@ int main() {
size_t length = 0;
int *array = input_array(MAX, length);

std::cout << find_k_statistics(array, 0, length, (length * 0.1)) << std::endl;
std::cout << find_k_statistics(array, 0, length, (length * 0.5)) << std::endl;
std::cout << find_k_statistics(array, 0, length, (length * 0.9)) << std::endl;
std::cout << find_k_statistics(array, length, (length * 0.1)) << std::endl;
std::cout << find_k_statistics(array, length, (length * 0.5)) << std::endl;
std::cout << find_k_statistics(array, length, (length * 0.9)) << std::endl;

delete[] array;

Expand Down

0 comments on commit 71436ea

Please sign in to comment.