CS136 Final: CS 136 - Final Exam
Document Summary
Pointer arithmetic: it is useful when we work with arrays, recall: for an array a, the value of a is the address of the first element (&a[0]) In array pointer notation, square brackets ([]) are not used, and all array elements are accessed through pointer arithmetic. 2: the choice of notation (pointers or []) is a matter of style and context. In most contexts, there is no practical difference between an array identified and an immutable pointer. Array map: selection sort, the smallest element is selected to be the first element in the new sorted sequence, and then the next smallest element is selected to be the second element, and so on, steps, 1. Find the position of the smallest element: 2. Substitute the first element with the smallest element. Substitute the element with the second one and so forth. Quick sort (partition-exchange sort or hoare"s quicksort: example of the divide & conquer algorithm, steps, 1.