COMPSCI 1JC3 Chapter Notes - Chapter 8: Tree Traversal, Beaufort Scale, Bubble Sort
Document Summary
Each operation compares two adjacent elements of the sequence, and exchanges them if necessary, so the latter element is larger. The first pass moves the largest value to the last position. When solving a problem, there are two approaches. Top-down approach - breaking a problem down into several smaller subproblems. Bottom-up approach - starts from given data, known quantities and methods to build up components that are combined to achieve a particular task or problem solution. Stepwise refinement - focusing on the big picture and get the solution framework going correctly. Definition contains the same term or concept without being circular, by using base cases. Split array into two parts, smaller elements to the left and larger elements to the right. Partition operation - operation that picks any element of the array as the partition element. Quicksort reduces the length of sequences to be sorted quickly, and performs the reordering in place.