QuickSort Algorithm : How to do quick sort and its time complexity | O(n logn)

Опубликовано: 04 Июнь 2026
на канале: Algorithm Practice
38
1

Sorting Algorithm. Use the QuickSort algorithm to sort the integer array. This is a problem from Leetcode and an example from ⌈CRACKING the CODING INTERVIEW⌋ P148. Better than BubbleSort and SelectionSort, the time complexity of QuickSort is O(n logn). And the basic idea of QuickSort is widely applied to problems that are needed to sort elements.

🚩 Problem description
https://leetcode.com/problems/sort-an...

Sort an array.

-------------------------------------------------------------------------------------------------------------

🚩 Problem-solving steps
1. Randomly choose a pivot, separate the array into LEFT and RIGHT
items that are less than pivot put in LEFT
items that are greater than the pivot put in RIGHT
2. Quicksort LEFT
3. Quicksort RIGHT

-------------------------------------------------------------------------------------------------------------

✅ GitHub link: https://github.com/macknever/CTCI_exa...