bg287

csc201 20101108 Notes

Posted in csc201 by bnmng on 2010 11/08

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: