NOTE: This web site is out of date.
This is the course web site from a past quarter, Winter 2018.
If you are a current student taking the course, this is not your class web site, and you should visit the current class web site instead at http://cs106b.stanford.edu/.
If you are already at http://cs106b.stanford.edu/, the web page may not be updated yet for the new quarter.
Please be advised that courses change with each new quarter and instructor.
Any information on this out-of-date page may not apply to you this quarter.
(Suggested book reading: Programming Abstractions in C++, section 7.5, 10.1)
Today we will discuss a few algorithms for sorting the data in a vector.
One algorithm is selection sort, which repeatedly finds the smallest remaining element and swaps it to the front:
Another algorithm is merge sort, which involves splitting the data in half, sorting the halves, and then merging the sorted halves into a sorted whole:
There are a huge number of sorting algorithms, each with its own pros and cons.
This makes sorting an interesting problem to study in terms of the tradeoffs and algorithm analysis.
In your file's comment header, list your name and contact information clearly; also cite all sources of help, including books, web pages, friends, section leaders, etc.
Do not consult any assignment solutions that are not your own.
Do not attempt to disguise any code that is not your own.
Do not give out your assignment solution to another student.
Do not ever post your homework solution code online. (e.g. PasteBin, DropBox, web forums).
Please take steps to ensure that your work is not easily copied by others.
If this is an assignment that allows pairs, the same rules apply to each team.
For example, do not look at assignment solutions that do not belong to your team, and do not give your solution to anyone outside of your team.
Remember that we run similarity-detection software over all solutions,
including this quarter and past quarters, as well as any solutions we find on the web.
If you need help solving an assignment, we are happy to help you.
You can go to the LaIR,
or the course message forum,
or email your section leader,
or visit the instructor / head TA during office hours.
You can do it!