I need to follow my heart.

Apr 10, 2009

Bubble Sort

Input: A[]

for (i = 1; i <= length[A]; i++)
    {
         for (j = length[A]; j >=i; j--)
           {
              if (A[j] < A[j-1])
                   Exchange (A[j], A[j -1]);
           }
     }

Features:
1. Stable

No comments: