Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CSCI 30: Data Structures and Algorithms Quiz 7

First Semester, 2021–2022 October 23, 2021

Due: October 26, 2021 at 6 PM on Gradescope

1. Fill in the blanks (short answers only).


(a) Las Vegas algorithms are guaranteed to be , [2]
but the is a random variable.
(b) The best case for quicksort happens when the element is [1]
selected as the pivot, which would partition the array into two equal halves.
(c) On the other hand, the worst case for quicksort happens when either the [2]
minimum or maximum element is selected as the pivot, which would parti-
tion the array (of n elements) into one subarray of size and
another subarray of size .
(d) A stable sort preserves the of the elements in [1]
case of ties.

2. Illustrate the operation of radix sort (last character first) on the following list of [6]
three-letter English words:

DOG
POG
SEA
RUG
SUS
ROW
MOB
BOX
BAR
As an example, your answer should look something like this:

DIG TEA TEA BIG


BIG DIG DIG DIG
TEA BIG BIG FOX
NOW NOW NOW NOW
FOX FOX FOX TEA

CSCI 30 Quiz 7 Page 2 of 2

You might also like