← 返回 meta 的题目列表Complexity Optimization
类型:online_judge
Given a problem solved by a quick select algorithm, your task is to find a solution with a better worst time complexity. You may assume the input is an integer array and the goal is to find the k-th smallest element. Please write an algorithm with the smallest worst time complexity. Example input: array [3, 2, 1, 5, 6, 4], k=2, Output: The 2nd smallest element in the array.
Example
Input
[3, 2, 1, 5, 6, 4] 2