Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Insertion sort algorithm

INSERTION-SORT(A)
   for i = 1 to n
   	key ← A [i]
    	j ← i – 1
  	 while j > = 0 and A[j] > key
   		A[j+1] ← A[j]
   		j ← j – 1
   	End while 
   	A[j+1] ← key
  End for 
Source by www.interviewbit.com #
 
PREVIOUS NEXT
Tagged: #Insertion #sort #algorithm
ADD COMMENT
Topic
Name
8+3 =