Merge Sort
From charlesreid1
Overview
Merge sort is one of the three solid $ \Theta( n \log{n})</math sort algorithms. (The other two are heap sort and (randomized) quick sort.) ==Brief Description== Merge sort is the sort analogue of binary search - we sort by continually splitting the array of data in half, until we reach the trivial case of an array with a single piece of data in it. Each recursive instance of merge sort then has a single piece of data, and these functions begin to merge their sorted results together. ==Algorithm Analysis== Because the continual splitting in half is O(log n) per step, for O(n log n) overall, and because the merge operation is linear, O(n), we can use the [[Master Theorem]] to prove a stronger result than O(n log n). We can show: <math> T(n) = \Theta \left( n \log{n} \right) $
See Algorithm Analysis/Merge Sort for the Master Theorem analysis of merge sort.
Flags
| Algorithms Part of Computer Science Notes
Series on Algorithms
Algorithms/Sort · Algorithmic Analysis of Sort Functions · Divide and Conquer · Divide and Conquer/Master Theorem Three solid O(n log n) search algorithms: Merge Sort · Heap Sort · Quick Sort Algorithm Analysis/Merge Sort · Algorithm Analysis/Randomized Quick Sort
Algorithms/Search · Binary Search · Binary Search Modifications
Algorithms/Combinatorics · Algorithms/Combinatorics and Heuristics · Algorithms/Optimization · Divide and Conquer
Algorithms/Strings · Algorithm Analysis/Substring Pattern Matching
Algorithm complexity · Theta vs Big O Amortization · Amortization/Aggregate Method · Amortization/Accounting Method Algorithm Analysis/Matrix Multiplication
Estimation Estimation · Estimation/BitsAndBytes
Algorithm Practice and Writeups Project Euler · Five Letter Words · Letter Coverage
|