● Bubble Sorting
Using system;
Namespace bubblesorter
{
Public class bubblesorter
{
Public void sort (INT [] list)
{
Int I, j, temp;
Bool done = false;
J = 1;
While (j <list. Length )&&(! Done ))
{
Done = true;
For (I = 0; I <list. Length-J; I ++)
{
If (List> List)
{
Done = false;
Temp = List;
List = List;
List= Temp;
}
}
J ++;
}
}
}
Public class mainclass
{
Public static void main ()
{
Int [] iarrary = new int };
Bubblesorter SH = new bubblesorter ();
Sh. Sort (iarrary );
For (INT m = 0; m <iarrary. length; m ++)
Console. Write ("{0}", iarrary [m]);
Console. writeline ();
}
}
}
● Select sorting
Using system;
namespace selectionsorter
{< br> public class selectionsorter
{< br> private int min;
Public void sort (INT [] list)
{< br> for (INT I = 0; I {< br> min = I;
for (Int J = I + 1; j {< br> If (list [J] min = J;
}< br> int T = list [Min];
list [Min] = List;
List = T;
}
}
}
Public class mainclass
{
Public static void main ()
{
Int [] iarrary = new int };
Selectionsorter Ss = new selectionsorter ();
SS. Sort (iarrary );
For (INT m = 0; m <iarrary. length; m ++)
Console. Write ("{0}", iarrary [m]);
Console. writeline ();
}
}
}
● Insert sorting
Using system;
namespace insertionsorter
{< br> public class insertionsorter
{< br> Public void sort (INT [] list)
{< br> for (INT I = 1; I {< br> int T = List;
Int J = I;
while (j> 0) & (list [J-1]> T)
{< br> list [J] = list [J-1];
-- J;
}< br> list [J] = T;
}
}
}
Public class mainclass
{
Public static void main ()
{
Int [] iarrary = new int };
Insertionsorter II = new insertionsorter ();
Ii. Sort (iarrary );
For (INT m = 0; m <iarrary. length; m ++)
Console. Write ("{0}", iarrary [m]);
Console. writeline ();
}
}
}
● Hill sorting
Using system;
Namespace shellsorter
{
Public class shellsorter
{
Public void sort (INT [] list)
{
Int Inc;
For (INC = 1; INC <= List. Length/9; Inc = 3 * Inc + 1 );
For (; INC> 0; INC/= 3)
{
For (INT I = inc + 1; I <= List. length; I + = Inc)
{
Int T = List ;< br> Int J = I;
while (j> Inc) & (list [j-inc-1]> T)
{< br> list [J-1] = list [j-inc-1];
J-= Inc;
}< br> list [J-1] = T;
}< BR >}< br> public class mainclass
{< br> Public static void main ()
{< br> int [] iarrary = new int };
shellsorter SH = new shellsorter ();
Sh. sort (iarrary);
for (INT m = 0; m console. write ("{0}", iarrary [m]);
console. writeline ();
}< BR>}