mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
Update insertion sort challenge (#137)
Update constraints and algorithm.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
"* Is a naiive solution sufficient?\n",
|
||||
"* Is a naive solution sufficient?\n",
|
||||
" * Yes\n",
|
||||
"* Are duplicates allowed?\n",
|
||||
" * Yes\n",
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
"* Is a naiive solution sufficient?\n",
|
||||
"* Is a naive solution sufficient?\n",
|
||||
" * Yes\n",
|
||||
"* Are duplicates allowed?\n",
|
||||
" * Yes\n",
|
||||
@@ -72,8 +72,15 @@
|
||||
" * Break\n",
|
||||
"\n",
|
||||
"Complexity:\n",
|
||||
"* Time: O(n^2) avarage, worst. O(1) best if input is already sorted.\n",
|
||||
"* Space: O(1), stable"
|
||||
"* Time: O(n^2) avarage, worst. O(1) best if input is already sorted\n",
|
||||
"* Space: O(1) for the iterative solution\n",
|
||||
"\n",
|
||||
"Misc: \n",
|
||||
"\n",
|
||||
"* In-place\n",
|
||||
"* Stable\n",
|
||||
"\n",
|
||||
"Insertion sort works well for very small datasets where most of the input is already sorted."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user