Quick Sort

Last updated

What is Quick Sort?

Quicksort, also known as partition-exchange sort, is an efficient, in-place sorting algorithm, which uses divide and conquer principles. It was developed by Tony Hoare in 1959. It operates by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. The sub-arrays are then recursively sorted. This process continues until the base case is achieved, which is when the array or sub-array has zero or one element, hence is already sorted. Quicksort can have worst-case performance of O(n^2) if the pivot is the smallest or the largest element in the array, although this scenario is rare if the pivot is chosen randomly. The average case time complexity is O(n log n).

Free resources to learn Quick Sort

More in stage 9: Graph Data Structures

Quick Sort: common questions

Can I learn Quick Sort in Hindi?

This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Quick Sort in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.

Is this Quick Sort tutorial for beginners?

It is lesson 48 of 107 in the free Data Structures & Algorithms roadmap, in stage 9, Graph Data Structures. If you are new to Data Structures & Algorithms, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.

Still confused? Ask me