Insertion Sort
Insertion Sort check two number of list and change its Position with correct Position in any order may be Assending or Dessinding Order. Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.

Insertion Sort Algorithm Implementation
s=int(input("Inter Your List Size"))
A=[]
for a in range (s):
x=int(input("Enter Element"))
A.append(x)
for i in range (1,s):
t=A[i]
j=i-1
while j >= 0 and t < A[j]:
A[j+1]=A[j]
j=j-1
A[j+1]=t
print(A)
Insertion Short Algorithm Analysis
Best Case: O(n)
Average Case: O(n^2)
Worst Case: O(n^2)
Space Complecity: 1
Insertion Short Algorithm are Internal Shorting Algorithm
Insertion Short Algorithm are Non-Recursive Shorting Algorithm
Stability: Yes Insertion Short Algorithm Are Stable Algorithm
Adpative: Yes Insertion Short Algorithm Are Adpative Algorithm