Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8c5d34c

Browse files
add kthSmallest
1 parent 1174853 commit 8c5d34c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/main/java/ir/sk/algorithm/mathematic/SelectionProblem.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ public static double medianUsingCountingSort(int[] array) {
7070
return median;
7171
}
7272

73-
73+
@TimeComplexity("O(n log n)")
74+
public int kthSmallest(int[] array, int k) {
75+
Arrays.sort(array);
76+
return array[k];
77+
}
7478

7579
// partition function similar to quick sort
7680
// Considers last element as pivot and adds

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /