Wednesday, 5 November 2014


Hye and Assalamualaikum. Today i am going to post about sorting
One of the sorting i will share here is insertion sort and buble sorting

insertion sort

-it is efficient for small number of data
-its is simple implementation and stable


for x=1 to n-1
 while i>=0 and A[i]>key
      A[i+1] = A[i]

bubble sorting

-bubble sorting is famous and frequently used.
-start comparing with first two array and swapping it.
-and same to others. it will continue swapping until it is arranged and sort

for i from x downto 1 {
for y from 1 to i-1{
       if (A[j]>A[j+1])

No comments:

Post a Comment