DSC 40B Practice Problems

Problems tagged with "quickselect"

Problem #048

Tags: quickselect

True or False: quickselect requires the input array to be sorted in order to function correctly.

True False
Solution

False.

Problem #075

Tags: quickselect, loop invariants

Recall the partition operation from quickselect. Which of the following arrays could have been partitioned at least once? Select all that apply.

Solution

The second, third, and last all should be selected.

Problem #086

Tags: quickselect

True or False: in order to guarantee that its output is correct, quickselect must be called on a sorted list.

True False
Solution

False.