Main Page

## 20.4. Wrap-UpThis chapter discussed searching and sorting data. We discussed the binary search algorithma faster, but more complex searching algorithm than linear search (Section 7.7). The binary search algorithm will only work on a sorted array, but each iteration of binary search eliminates half of the elements in the array. You also learned the merge sort algorithm which is a more efficient sorting algorithm than either insertion sort (Section 7.8) or selection sort (Section 8.6). We also introduced Big O notation, which helps you express the efficiency of an algorithm. Big O notation measures the worst case runtime for an algorithm. The Big O value of an algorithm is useful for comparing algorithms to choose the most efficient one. In the next chapter, you will learn about dynamic data structures that can grow or shrink at execution time. |