CMPU-203: Introduction to Computer Science III
Quiz #7
Due: Wednesday, April 24
For each of the following situations, pick the algorithm you would use
to best solve the problem. When multiple choices seem possible,
select the best one and say why. First go through them all and
provide suggested answers and explanations. Then begin to write
code snippets that you think will implement each one. Your snippets
must include the container types you propose using.
-
You have a string and you want to know if the string "xyz" appears
somewhere within it.
-
You have two sorted containers of students, and you need to know if
there is any student on one list that isn't on the other. If there is
one, you need to know what it is.
-
You need to know how many students in a container are taking more than
3 courses.
-
You have a container of faculty, whose instances have a private data
member called salary. You need to increase the salary of each element
of the container by 4%.