Insert order

xiaoxiao2021-03-05  24

Public String InsertSort (int M, String C, INT N) {

String [] str2 = new string [m 1];

String strTemp1 = null;

StringBuffer SB = new stringbuffer ();

Str2 = c.split (",");

INT i = 0;

While (i

{i ;

}

IF (i == n)

{str2 [i] = STR2 [i 1];

STR2 [i 1] = ""

}

Else

{

Strtemp1 = STR2 [I];

STR2 [I] = STR2 [N 1];

For (int J = n 1; j> i 1; j -)

{

STR2 [J] = STR2 [J-1];

}

STR2 [i 1] = strTemp1;

STR2 [N 1] = ""

}

For (int x = 0; x

{sb.append (STR2 [x] ",");

} // for

Return sb.toString ();

}

转载请注明原文地址:https://www.9cbs.com/read-37797.html

New Post(0)