From c69769757de1da7fe12682c77f70fe46184d306d Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Tue, 17 Jan 2017 06:16:43 -0500 Subject: [PATCH] Update merge sort challenge algorithm discussion (#138) --- .../merge_sort/merge_sort_challenge.ipynb | 2 +- .../merge_sort/merge_sort_solution.ipynb | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sorting_searching/merge_sort/merge_sort_challenge.ipynb b/sorting_searching/merge_sort/merge_sort_challenge.ipynb index 33de82e..49445ff 100644 --- a/sorting_searching/merge_sort/merge_sort_challenge.ipynb +++ b/sorting_searching/merge_sort/merge_sort_challenge.ipynb @@ -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", diff --git a/sorting_searching/merge_sort/merge_sort_solution.ipynb b/sorting_searching/merge_sort/merge_sort_solution.ipynb index 1fde348..a3fe0e2 100644 --- a/sorting_searching/merge_sort/merge_sort_solution.ipynb +++ b/sorting_searching/merge_sort/merge_sort_solution.ipynb @@ -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", @@ -75,9 +75,18 @@ "\n", "Complexity:\n", "* Time: O(n log(n))\n", - "* Space: O(n+m), n = number of elements, m = recursion depth\n", + "* Space: O(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)" ] }, {