Skip to content

Commit 8ea2337

Browse files
Update search/Quickselect for Finding the k-th Smallest Element.cpp
Co-authored-by: realstealthninja <[email protected]>
1 parent 709c542 commit 8ea2337

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

search/Quickselect for Finding the k-th Smallest Element.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,5 @@ static void test() {
9191
*/
9292
int main(int argc, char *argv[]) {
9393
test(); // Run self-test implementations
94-
95-
vector<int> arr = {3, 2, 1, 5, 6, 4};
96-
int k = 2; // We want the 2nd smallest element
97-
98-
// Input validation for k
99-
if (k < 1 || k > arr.size()) {
100-
cout << "Error: k must be between 1 and " << arr.size() << endl;
101-
return -1;
102-
}
103-
104-
cout << k << "-th smallest element is " << quickSelect(arr, 0, arr.size() - 1, k - 1) << endl;
10594
return 0;
10695
}

0 commit comments

Comments
 (0)