Design an algorithm that, given two strings of characters, tests whether
the first string appears as a sub-string somewhere in the in the second.
Your algorithm should report positively (or true) if there exist one or more
occurrences of the first string within the second, and negatively (or false)
otherwise. For example, given the two strings "up" and "super
duper", your procedure should report that it is true the string
"up" appears within the string "super duper". On the
other hand, given the two strings "down" and "super
duper", you procedure should report false.
For the following questions, consider the algorithm below that
characterizes the behavior of a student registering for classes. Assume that
the student must take at least 4 credit hours to be a full-time student and
may take up to 5.5 credit hours.
- Make a list of courses for which you want to register.
- Label the courses with a priority, giving priority 1 to your
highest priority course and priority 10 to your lowest priority course.
- Create a number called "Hours Scheduled."
- Begin with an empty schedule: Record 0 for "Hours
Scheduled."
- Choose the highest priority class on the list.
- If (the chosen class is not full) and (its class time does not
conflict with classes already scheduled) then register for class:
- Add the class to your schedule.
- Add the class hours to the "Hours Scheduled."
- Cross the class off of your list.
- Repeat steps 5 through 7 until ("Hours Scheduled" is
greater than or equal to 4) or (all classes have been crossed out).