Insertion Sort Algorithm

Changfeng Tan
Apr 8, 2021

--

Insertion sort is one of the fundamental sorting algorithms in the field of computer science. It is not as efficient as other sorting algorithms like quicksort, merge sort, or heapsort but it has its own advantages.

Advantages of insertion sort:

  1. Easy to understand and to implement.
  2. It is stable, in other words, the algorithm wouldn’t swap with equal value pair.
  3. It is in-place, in other words, the memory required by the algorithm wouldn’t be changed.

Python code implementation:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response