Lecture 6
- Admin: please note date for Midterm Exam.
- Basics of memory allocation: arrays, local versus global
variables versus function parameters.
- IN/OUT parameters to functions
- Sorting
algorithms, applets from Dominique's web page. Compare
Insertion and Selection Sort.
- Templates in C++.Motivation: sorting characters instead of
integers.
Example using Insertion Sort.
- In-class lab (nothing to submit):
Example of sorting other type of data without rewriting the whole
program using templates in C++. Copy the code of
a program that performs selection sort
here. Modify it:
- To make it as readable as possible (add spaces, dividers,
your name, account, etc.)
- To sort both an array of characters and an array of
integers. Use templates.