Skip to main content
Contents Index
Dark Mode Prev Up Next
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 7.11 Discussion Questions
Generate a random list of integers. Show how this list is sorted by the following algorithms:
shell sort (you decide on the increments)
quick sort (you decide on the pivot value)
Consider the following list of integers: [1,2,3,4,5,6,7,8,9,10]. Show how this list is sorted by the following algorithms:
shell sort (you decide on the increments)
quick sort (you decide on the pivot value)
Consider the following list of integers: [10,9,8,7,6,5,4,3,2,1]. Show how this list is sorted by the following algorithms:
shell sort (you decide on the increments)
quick sort (you decide on the pivot value)
Consider the list of characters: [
'P','Y','T','H','O','N']. Show how this list is sorted using the following algorithms:
shell sort (you decide on the increments)
quick sort (you decide on the pivot value)
Devise alternative strategies for choosing the pivot value in quick sort. For example, pick the middle item. Re-implement the algorithm and then execute it on random data sets. Under what criteria does your new strategy perform better or worse than the strategy from this chapter?