You should be able to define and explain the following terms:
Running time of an algorithm
Big-O notation (also known as "order notation")
Searching
Linear search, including its input requirements, the details of the
algorithm, and its worst-case running time
Binary search, including its input requirements, the details of the
algorithm, and its worst-case running time
Sorting
Bubble sort, including the details of the algorithm and its worst-case
running time
Selection sort, including the details of the algorithm and its worst-case running time
Recursion vs Iteration
Practice problems:
True/False 1-5 on page 460
Multiple choice problems 1-4 on page 461
Discussion questions 1-2 on page 462
What are the minimum and maximum possible number of steps linear
search will need to find a value in a list of 64 items?
What are the minimum and maximum possible number of steps
binary search will need to find a value in a list of 64 items?
Show the low, high, and mid values for each step of a binary
search for the value 7 in this list:
[2, 4, 5, 10, 14, 18, 22, 31]
Suppose you were going to sort the following list using selection
sort. Show how the list would be changed after one iteration through
selection sort. Explain in your own words the key idea of selection
sort.
[12, 3, 7, 1, 8, 2, 5, 4, 10, 9]
Suppose you were going to sort the same list above using bubble
sort. Show how the list would be changed after one interstion through
bubble sort. Explain in your own words the key idea of bubble sort.
Write an iterative function sumEvenIter(n) that returns
the sum of the even numbers between 2 and n inclusive. For example,
sumEvenIter(8) would return 2+4+6+8 which is 20.
Write a recursive function sumEvenRecur(n) that returns
the sum of the even numbers between 2 and n inclusive.
Write an interative function countIter(ls, item) that
returns a count of how many times the given item appears in the given
list. For example, countIter([5, 1, 2, 5, 4, 5], 5) would return 3
since the number 5 appears three times in the list.
Write a recursive function countRecur(ls, item) that
returns a count of how many times the given item appears in the given
list.