Sizing three-way recursive ranges

A warehouse sorts batches of packages by integer priority key. A three-way partition separates a range into records below the pivot key, records equal to it, and records above it. Quick Sort then sorts only the below-pivot and above-pivot ranges. The entire equal-key block, including the chosen pivot record, is excluded from further recursive sorting.


The table gives all key frequencies for three separate batches. A frequency is a count of records, and the selected pivot record is already included in that count.


Batch

Key 1 count

Key 3 count

Key 6 count

Key 9 count

Pivot key

Dispatch

4

7

5

2

3

Returns

3

2

8

4

6

Express

6

3

2

5

1


Complete the table with exact integer counts. Report both recursive range sizes and the number of records excluded in the equal-key block. Count every record equal to the pivot, not just the chosen pivot record.

BatchBelow-pivot range sizeAbove-pivot range sizeExcluded equal-key records
Dispatch
Returns
Express

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Quick Sort Questions: