Insertion sort is a very simple sorting algorithm. Insertion sort is an in-place and comparison based algorithm in which an element is compared with its previous adjacent element and sorted. In this algorithm after each iteration we get a partially sorted algorithm.
Insertion sort works well with small datasets but its efficiency decreases when the size of the dataset increases. It is less efficient that quick sort, merge sort or heap sort but is better that selection and bubble sort.
It has a worst case time complexity of o(n2), hence is less efficient for large datasets.
To know more about insertion sort and its uses and advantages click Here.
You might also be interested in
Bubble sort Algorithm
Selection Sort Algorithm
Hashing with Quadratic Probing
Hashing with Linear Probing
Find Trailing number of zeros in factorial of a number.
Check if a number is a Fibonacci number or not
Find Factorial of a number
Insertion sort works well with small datasets but its efficiency decreases when the size of the dataset increases. It is less efficient that quick sort, merge sort or heap sort but is better that selection and bubble sort.
It has a worst case time complexity of o(n2), hence is less efficient for large datasets.
To know more about insertion sort and its uses and advantages click Here.
C Program
C++ Program
Sample input and output to check the program
You might also be interested in
Bubble sort Algorithm
Selection Sort Algorithm
Hashing with Quadratic Probing
Hashing with Linear Probing
Find Trailing number of zeros in factorial of a number.
Check if a number is a Fibonacci number or not
Find Factorial of a number
Comments
Post a Comment