(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.
You are expected to follow the Stanford Honor Code.
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!