Skip to main content
Contents Index
Search Book
Search Results:
No results.
Readability settings Prev Up Next
\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\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 22.7 Practice: Bubble Sort
Check Your Understanding Check Your Understanding
1.
From where does "Bubble Sort" get its name?
Largest elements bubble gradually to the top
Correct
Named after Edgar D. Bubble
Not quite. Try again!
It was invented by the same person who invented gum
Not quite. Try again!
No reason
Not quite. Try again!
2.
Complete the following C program so that it correctly sorts the given array from smallest to largest using bubble sort. In particular, you need to complete the function
bubbleSort() below which handles the sorting. Everything else has been done for you already.
admin ..... open in new window
When your program performs correctly youโll be given a keyword to enter in Canvas.
3.
Suppose that you have made the following declarations:
int num[] = {5,3,7,9,2,4,6};
int index[] = {2,3,4,5,6,7,1};
What is
index[3]?
Choose one: 1 / 2 / 3 / 4 / 5
What is
num[index[3]]?
Choose one: 2 / 3 / 4 / 5 / 6 / 7 / 9
Feel free to use the window below to try out some code. Be sure to work the correct answer out "by hand" first before verifying your answer using the code window.
admin ..... open in new window
Enter your two answers, separated by a comma, i.e. 8, 1