Skip to content

Commit

Permalink
Update 033-insertion-sort-python.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rylim authored Oct 12, 2021
1 parent 4821e46 commit fb8a8a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/033-insertion-sort-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ As you can see, it closely follows the pseudocode, with some minimal code saving

## Runtime

As mentioned, the average runtime for this algorithm is `O(n^2)`. The best case is an array that is already sorted with a runtime of `O(n)` as the current element in the array will only be compared once with a prior element. The worst case is an array that is sorted in reverse as each new element will need to be compared (and swapped) to every prior element to the beginning of the array.
As mentioned, the average runtime for this algorithm is `O(n^2)`. The best case is an array that is already sorted with a runtime of `O(n)` as the current element in the array will only be compared once with a prior element. The worst case is an array that is sorted in reverse as each new element will need to be compared (and swapped) with every prior element to the beginning of the array.

Thanks for reading, any comment or feedback is most welcome!

0 comments on commit fb8a8a9

Please sign in to comment.