Skip to main content
Contents Index
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\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\,}$}}}
\)
Exercises 29.7 Exercises
1.
You do not need to worry about the queue being full, but you should correctly handle wrapping.
2.
3.
You will need your
enqueue and
dequeue functions.
4.
It should double the size of the underlying array and copy the existing elements to the new array in the correct order.
You will need your
enqueue and
dequeue functions.
Hint 1 .
You will need to loop from start to end and may need to wrap around while looping.
Hint 2 .
You will likely need/want a different counter for the location in the new array. The logic is easiest if you place the elements in the new array starting from 0. They will never need to wrap in the new array.
You have attempted
of
activities on this page.