> For the complete documentation index, see [llms.txt](https://junnie.gitbook.io/nine-chapter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://junnie.gitbook.io/nine-chapter/8.data-structure/461kth-smallest-numbers-in-unsorted-array.md).

# 461.Kth Smallest Numbers in Unsorted Array

## 1.Description(Medium)

Find the kth smallest numbers in an unsorted integer array.

**Example**

Given`[3, 4, 1, 2, 5]`, k =`3`, the 3rd smallest numbers are`[1, 2, 3]`.

[**Challenge**](https://www.lintcode.com/en/problem/kth-smallest-numbers-in-unsorted-array/#challenge)

An O(nlogn) algorithm is acceptable, if you can do it in O(n), that would be great.

## 2.Code

Version 1: BruteForce O(nlogn)

Sort the array, return array\[k-1];

Version 2: QuickSort
