Algorithm and Pseudocode for Insertion Sort


What is Insertion Sort?

Insertion Sort is one of the simplest sorting algorithms in which every Element is Inserted at a proper place in a Sorted List. In real life, we use Insertion Sort to sort the Playing Card.

Insertion Sort Algorithm or Pseudocode

Pseudocode for Insertion Sort:

Step 1: Start Step 2: If it is the first element, it is already sorted, return 1 Step 3: Pick next element Step 4: Compare with all elements in sorted sub-list Step 5: Shift all the elements in the sorted sub-list that is greater than the value to be sorted Step 6: Insert the value Step 7: Repeat until list is sorted Stop 8: Stop
Similar Posts:
  1. Algorithm For Prime Number
  2. Selection Sort Algorithm and Flowchart
  3. Binary Search Algorithm
  4. Algorithm for Factorial of a Number
  5. Merge Sort Algorithm or Pseudocode in Java
Solution Worked 3 UpvotesUpvote
        
Solution Didn't Worked 1 DownvotesDownvote


Comments




Search