bg287

csc201 20101110 Notes

Posted in csc201 by bnmng on 2010 11/10

Probably one more program due for rest of class.
Test Monday.
Reading for Wednesday: Read 14.1

The following items will probably be on the test.
Brute force search: Two versions.
If the list is unsorted, assuming it doesn’t find the sought value, than it will go through the whole list.
If the list is sorted, than even if it doesn’t find the value, it can stop looking when the value is exceeded.
(either way, if it does find it’s value, it can stop going through the list when it finds it).

Remember the five types of functions in a class:
Constructors
Transformers
Observers
Iterators
Destructors

By default, members of a class are private. Public functions have to be defined in a public section.

Inside the class, private and public functions and variables are available.
Outside the class only public functions and variables are available (and we rarely define public variables).

.h files have the specification and documentation of classes.
.cpp files have the implementation
the main brings them together

We have constructors that take arguments and default constructors that don’t take arguments.
We need the defaults for arrays. You cannot pass parameters to an array when creating it.

Understand the selection sort. Understand what happens in the inner loop.
There will likely be a question like this:
5 89 4 27 99 15 87 77 34
What will this look like after three passes of a selection sort?
Answer
Pass 1 (finds the 4, swaps it with the 5)
4 89 5 27 99 15 87 77 34
Pass 2 (finds the 5, swaps it with the 89)
4 5 89 27 99 15 87 77 34
Pass 3 (finds the 15, swaps it with the 89)
4 5 15 27 99 89 87 77 34

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: