Search for notes by fellow students, in your own course and all over the country.
Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.
Title: DSA - Merge Sort
Description: This notes contains a summary of Merge sort algorithm. It has the explanation, algorithm and its time complexity along with bonus details about the sorting technique.
Description: This notes contains a summary of Merge sort algorithm. It has the explanation, algorithm and its time complexity along with bonus details about the sorting technique.
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
Merge Sort
Explanation:
Merge sort is a sorting algorithm that works by dividing the array in half, sorting each half
recursively, and then merging the two sorted halves back together
...
This
process is done recursively until all the elements from both halves have been copied into the new
array
...
append(left
...
append(right
...
extend(left)
result
...
This is because the algorithm divides the array
in half at each step, and the merge step takes linear time
...
Space complexity:
The space complexity of the merge sort is O(n)
...
The size of each half is half the size of the original
array, so the total space complexity is O(n)
...
A stable sorting algorithm is where the relative
order of elements with equal values is preserved
...
Merge sort is efficient for large arrays
...
Merge sort is not as efficient for small arrays as other sorting algorithms, such as
insertion sort
...
It is also a stable sorting algorithm, which makes it a good choice for sorting data where
the relative order of elements with equal keys is important
Title: DSA - Merge Sort
Description: This notes contains a summary of Merge sort algorithm. It has the explanation, algorithm and its time complexity along with bonus details about the sorting technique.
Description: This notes contains a summary of Merge sort algorithm. It has the explanation, algorithm and its time complexity along with bonus details about the sorting technique.