mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Added notes about sort stability.
This commit is contained in:
parent
56509aaf96
commit
631519cdfe
|
@ -51,7 +51,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n^2) avarage, worst. O(1) best if input is already sorted.\n",
|
"* Time: O(n^2) avarage, worst. O(1) best if input is already sorted.\n",
|
||||||
"* Space: O(1)"
|
"* Space: O(1), stable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n log(n)) average, best, O(n^2) worst\n",
|
"* Time: O(n log(n)) average, best, O(n^2) worst\n",
|
||||||
"* Space: O(n), n extra space, n recursion depth"
|
"* Space: O(n), n extra space, n recursion depth, generally not stable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n^2) average, worst, best\n",
|
"* Time: O(n^2) average, worst, best\n",
|
||||||
"* Space: O(1) iterative, O(n) recursive (unless tail-call elimination is available, then O(1))"
|
"* Space: O(1) iterative, O(n) recursive (unless tail-call elimination is available, then O(1)), generally not stable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user