Quicksort — Pivot Partitioning
Descripción
Demonstrates the quicksort algorithm on an unsorted array using in-place pivot partitioning. Shows the two-pointer sweep with elements being classified relative to the pivot, the pivot landing in its final sorted position, and recursive application to subarrays. Displays both average and worst-case complexities.
Quicksort — Pivot Partitioning
Description
Demonstrates the quicksort algorithm on an unsorted array using in-place pivot partitioning. Shows the two-pointer sweep with elements being classified relative to the pivot, the pivot landing in its final sorted position, and recursive application to subarrays. Displays both average and worst-case complexities.
Phases
| # | Phase Name | Duration | Description |
|---|---|---|---|
| 1 | Intro | 3s | Title and unsorted array displayed |
| 2 | Pivot Selection | 4s | Last element chosen as pivot, highlighted in gold |
| 3 | Partition Pass 1 | 12s | Two-pointer sweep: left finds element > pivot, right finds element < pivot; elements swap |
| 4 | Pivot Placement | 4s | Pivot moves to its final sorted position |
| 5 | Recursion | 16s | Visualize recursive calls on left and right subarrays |
| 6 | Complexity | 5s | Average O(n log n) and worst O(n²) displayed |
| 7 | Outro | 4s | Fully sorted array highlighted |
Layout
+--------------------------------------------------+
| Title: Quicksort — Pivot Partitioning |
+--------------------------------------------------+
| |
| [6][3][8][1][9][2][7][4] <- array row |
| i j [P] <- pointer labels |
| |
| Partition step visualized with arrows |
| |
| Recursion depth shown below main array |
| |
| Complexity box: |
| Avg: O(n log n) Worst: O(n²) bottom-right |
+--------------------------------------------------+
Area Descriptions
- Top strip: Title text
- Center: Main array with pointer annotations below each element
- Bottom: Subarray recursion visualization
- Bottom right: Complexity comparison panel
Assets & Dependencies
- Fonts: LaTeX / sans-serif
- Manim version: ManimCE 0.19.1
Notes
- Pivot highlighted in gold throughout
- Elements smaller than pivot colored cyan (left partition), larger colored orange (right partition)
- Once sorted position determined, pivot shown in bright green
- Show left pointer (i) and right pointer (j) with labeled arrows
Audiencia: Software EngineerCategoría: Cs