1
0
mirror of https://gitlab.com/magicalsoup/Highschool.git synced 2025-01-23 16:11:46 -05:00

Update Insertion Sort.md

This commit is contained in:
James Su 2019-11-06 17:02:12 +00:00
parent bee1e0a88b
commit 51716bd088

View File

@ -66,7 +66,7 @@ Number of passes and comparisons
- Insetion sort always require n-1 passes
- Mininimum number of comparisons = $`n-1`$
- maximum number of comparisons = $`\dfrac{n^2-n}{2}`$ or $`n(n-1)/2`$
- Average number of comparisons = $`\dfrac{n^2-n}{4}`$ or $n(n-1)/4`$
- Average number of comparisons = $`\dfrac{n^2-n}{4}`$ or $`n(n-1)/4`$
## When To Use
- Good to use when the array is `nearly sorted`, and only a few elements are misplaced