mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 09:58:03 +00:00
Update merge sort challenge algorithm discussion (#138)
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## Constraints\n",
|
"## Constraints\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Is a naiive solution sufficient?\n",
|
"* Is a naive solution sufficient?\n",
|
||||||
" * Yes\n",
|
" * Yes\n",
|
||||||
"* Are duplicates allowed?\n",
|
"* Are duplicates allowed?\n",
|
||||||
" * Yes\n",
|
" * Yes\n",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## Constraints\n",
|
"## Constraints\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Is a naiive solution sufficient?\n",
|
"* Is a naive solution sufficient?\n",
|
||||||
" * Yes\n",
|
" * Yes\n",
|
||||||
"* Are duplicates allowed?\n",
|
"* Are duplicates allowed?\n",
|
||||||
" * Yes\n",
|
" * Yes\n",
|
||||||
@@ -75,9 +75,18 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Complexity:\n",
|
"Complexity:\n",
|
||||||
"* Time: O(n log(n))\n",
|
"* Time: O(n log(n))\n",
|
||||||
"* Space: O(n+m), n = number of elements, m = recursion depth\n",
|
"* Space: O(n)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Most implementations are stable."
|
"Misc:\n",
|
||||||
|
"\n",
|
||||||
|
"* Not in-place\n",
|
||||||
|
"* Most implementations are stable\n",
|
||||||
|
"\n",
|
||||||
|
"Merge sort can be a good choice for data sets that are too large to fit in memory, as large chunks of data can be read and written to disk.\n",
|
||||||
|
"\n",
|
||||||
|
"Unlike many other sorting algorithms, merge sort is not done in-place.\n",
|
||||||
|
"\n",
|
||||||
|
"See: [Quicksort vs merge sort](http://stackoverflow.com/questions/70402/why-is-quicksort-better-than-mergesort)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user