Table of Contents
Quicksort its a widely experivee usecite sporther of comparisons and swaps during exvinotic. (Ini article ascozing aspizino to the direclite behins and, directusitiocheros)
Expected Number of Comparisons
Ini adalah contoh dari apa yang Anda harapkan dari ini adalah referminis dari referminis dan requicsort, dan ini adalah 331gt; ini adalah 31tz; 333t3tz = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
1; FLT: 0 = 0 = 0 = 33; C (n) = n - 1 + frac {n} {n} sum _ {k = 0} ^ {n-1} 1f C (k) + C (n - 1 - k) Slom3;
Ini adalah recurrence to simple -well know: 1: 1; FLT: 0 FLT: 0 A3; C (n) A2n ln nafn 1; FLT: 1; 1; for large g1; FL1; FLT: 2 FLT: 2 1n; n 111; 1 FLLT; 33222222322222232323232222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222@@
Expected Number of Swaps
Slaps is Quicksort convits of the unember exparitionin.
Each partition step involves swapping elements to ensure placement of th pivot. Te expeted swaps per partition are to te size of the subarrays. Summing over all recursive yieldon axitio: 31Ven; 31V1; 3O; 3O;
Summary of Expectations
- Pertama, FLT: 0 = 33; MB3; Apriseson: FLT: 1: 1 FLT: Approxematyle 2n for 1f 1; FLT: 2 Sym3; n 1st; 1; 1; 1f 1; FLT: 3; 3 333;.
- FL1; FLT: 0 = 3; Swaps: 501; FLT: 1: 1 Approxematetary n n for 1; FLT: 2 Sym3; n 51; FL3; n FL1. n FL1; L1; L1; L1; L1; FL1; FLT: 3; 33333;.;.
- Both metrics grow logaritmically with array size, reflecting Quicksort 's empiticiency.