Arjun Suresh (talk | contribs) |
Arjun Suresh (talk | contribs) |
||
| Line 19: | Line 19: | ||
|$\theta(n^{2})$ | |$\theta(n^{2})$ | ||
|$\theta(n^{2})$ | |$\theta(n^{2})$ | ||
| − | |$\theta(n)$ | + | |$\theta(n)$ (when array is sorted) |
|- | |- | ||
|Quick | |Quick | ||
| − | |$\theta(n^{2})$ | + | |$\theta(n^{2})$ (when array is sorted, and pivot taken from one end) |
|$\theta(nlgn)$ | |$\theta(nlgn)$ | ||
|$\theta(nlgn)$ | |$\theta(nlgn)$ | ||
| Algorithm | Worst Case | Average Case | Best Case |
|---|---|---|---|
| Bubble | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n^{2})$ |
| Selection | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n^{2})$ |
| Insertion | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n)$ (when array is sorted) |
| Quick | $\theta(n^{2})$ (when array is sorted, and pivot taken from one end) | $\theta(nlgn)$ | $\theta(nlgn)$ |
| Merge | $\theta(nlgn)$ | $\theta(nlgn)$ | $\theta(nlgn)$ |
| Heap | $\theta(nlgn)$ | $\theta(nlgn)$ | $\theta(nlgn)$ |
| Algorithm | Worst Case | Average Case | Best Case |
|---|---|---|---|
| Bubble | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n^{2})$ |
| Selection | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n^{2})$ |
| Insertion | $\theta(n^{2})$ | $\theta(n^{2})$ | $\theta(n)$ (when array is sorted) |
| Quick | $\theta(n^{2})$ (when array is sorted, and pivot taken from one end) | $\theta(nlgn)$ | $\theta(nlgn)$ |
| Merge | $\theta(nlgn)$ | $\theta(nlgn)$ | $\theta(nlgn)$ |
| Heap | $\theta(nlgn)$ | $\theta(nlgn)$ | $\theta(nlgn)$ |