## csc201 20101108 Notes

Program Due Monday the 15th.

Homework due Wednesday the 10th:

Chapter 13 Exam Prep 3, 6, 7. Warmup 1, 6, 7, 11

Test Monday the 15th. For Test: Make sure you understand brute force search (sequential search). Make sure you understand selection sort.

Sorting and Brute Force Searching (from Chapter 13):

A Selection Sort is an In Place Sort

Example

0 87

1 62

2 92

3 80

4 29

5 62

find the index of minumum. Start with Min Index of zero. Go through each number. If you find a number lower than then one in position zero, make the new mnin index the index of that number.

Swap the lowest number with the one in index zero.

Do the same for each iter of the outer loop, but start with a higher index.

In doing an insert to an ordered list, start at the high index. If the value of item with the highest index is lower than the new value, put the new value at the end. If the value of the item with the highest index is higher than the new value, copy the value of the item with the highest index to the new end. Then check the next lower item. Again, if it’s higher than the new value, copy it up. If not, put the new value into the spot above that one.

Test Topics :Selection Sort (what does the array look like after a certain # of passes)

Brute Force Search

leave a comment