Quick Sort Algorithm in C++: Understanding the Array-Based Implementation, Lecture notes of Design

An in-depth explanation of the Quick Sort algorithm in C++ with a focus on array-based lists. the divide-and-conquer technique, the process of partitioning the list into sublists, and the steps to implement the partition algorithm. This information is essential for computer science students and developers seeking to understand and apply the Quick Sort algorithm in their projects.

Typology: Lecture notes

2021/2022

Uploaded on 09/27/2022

bairloy
bairloy 🇺🇸

4.2

(6)

247 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
C++ Programming: Program Design
Including Data Structures, Fourth
Edition 1
Quick Sort: Array-Based Lists
Uses the divide-and-conquer technique
The list is partitioned into two sublists
Each sublist is then sorted
Sorted sublists are combined into one list in such a way so
that the combined list is sorted
pf3
pf4
pf5
pf8

Partial preview of the text

Download Quick Sort Algorithm in C++: Understanding the Array-Based Implementation and more Lecture notes Design in PDF only on Docsity!

C++ Programming: Program Design Including Data Structures, Fourth Edition

1

Quick Sort: Array-Based Lists

  • Uses the divide-and-conquer technique
    • The list is partitioned into two sublists
    • Each sublist is then sorted
    • Sorted sublists are combined into one list in such a way so that the combined list is sorted

2

Quick Sort: Array-Based Lists

(continued)

  • To partition the list into two sublists, first we choose

an element of the list called pivot

  • The goal is to re-arrange the list so that the pivot

divides the list into: lowerSublist and

upperSublist

  • The elements in lowerSublist are < pivot
  • The elements in upperSublist are ≥ pivot

C++ Programming: Program Design Including Data Structures, Fourth Edition

4

Quick Sort: Array-Based Lists

(continued)

  • Step 1 determines the pivot and moves pivot to

the first array position

  • During the execution of Step 2, the list elements get

arranged

C++ Programming: Program Design Including Data Structures, Fourth Edition

7

Quick Sort: Array-Based Lists

(continued)

C++ Programming: Program Design Including Data Structures, Fourth Edition

8

Analysis: Quick Sort