Bubble Sort

SSharp S# API

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

        a=[17, 0, 5, 3,1, 2, 55];

 

        for (i=0; i < a.Length; i=i+1)

         for (j=i+1; j <  a.Length; j=j+1)

          if (a[i] > a[j] )

          {

            temp = a[i];

            a[i] = a[j];

            a[j] = temp;

          }

 

         s = '';

         for (i=0; i < a.Length; i++)

          s = s + ',' + a[i];

 

         Test.AreEqual(',0,1,2,3,5,17,55',s);