Merge Sort Made Easy! (Code Meditation)

  • Can it get better than this for a comparison-based sorting algorithm? No.
  • So Why wait? let’s learn this ASAP and accurately.
  • We will also look at the shortcomings of Merge Sort at a later point.
Source

The Gist

Code:

Interesting facts about Merge Sort

  • MergeSort is a divide and conquer algorithm, we are splitting array and recursively working on individual subparts.
  • Merge sort needs O(n) amount of memory in order to copy over elements as it sorts. You might have noticed this as we were creating left and right sub-arrays every time. This is probably the greatest drawback of the merge sort algorithm: it is an out-of-place sorting algorithm, that requires additional memory as its dataset grows.
  • Merge sort can work well on any type of data sets irrespective of its size.

Complexity Analysis

Source

Final Comments

Resources:

--

--

--

Passionately Curious. Believer in Simplicity. Humble Writer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tecra team members. Sabrina Bilmak, Back-End developer

.NET 5 API Authorization Integration Tests

Java Libraries are Your Lambda Enemy

IoT Development Practices: Decoding a Cloud Solution

How to do well in a coding interview

8 Reasons Why You Should Blog as a Developer

How to solve the problem of git bash not appearing on the right mouse click!!

Dynamic DNS using Alibaba Cloud DNS API

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Achyuth Nandikotkur

Achyuth Nandikotkur

Passionately Curious. Believer in Simplicity. Humble Writer.

More from Medium

Six good reasons to become a java developer.

5 Hacks to boost your programming skills

5 Hacks to boost your programming skills

BEST SOFTWARE DEVELOPMENT

An overachiever’s guide to rest