8.1.11

Quick Sort Algorithm

Test yourself

Quick Sort Algorithm

The quick sort algorithm is a sorting algorithm that uses an element known as a pivot and works around it by dividing the elements.

Illustrative background for Divide and conquer paradigmIllustrative background for Divide and conquer paradigm ?? "content

Divide and conquer paradigm

  • Quick sort is based on the divide and conquer paradigm.
  • Quick sort consists of two phases:
    • 1- Partition phase
    • 2- Sorting phase
Illustrative background for Rearranging the arrayIllustrative background for Rearranging the array ?? "content

Rearranging the array

  • Quick sort selects an element as a pivot.
  • It rearranges the array in a way that all the elements to the left of the pivot will be smaller than the pivot.
  • All the elements to the right will be greater than the pivot.
    • Then quick sort recursively quick sort left and right subarrays.
Illustrative background for Stopping criteriaIllustrative background for Stopping criteria ?? "content

Stopping criteria

  • Stopping criteria:
    • 1- Every element is an old pivot
    • 2- A list of length 1

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium