Sorting
Significant advantage to using sorted data
Two basic types of sorting:
- Internal sorting takes place in the computer’s main memory
- External sorting uses secondary storage (disks)
E.g., sorting an array of characters containing “PROGRAMMING”
- char ar[11] = “PROGRAMMING”;
- ‘A’ means the character “A” (numeric value 65 in ASCII)
- May be useful to preserve the order of elements with identical value (e.g., ‘M’), if so the sorting algorithm is stable.