Boundary sort

xiaoxiao2021-03-05  48

Function RadixSort (C, N)

{

VAR Arr1 = ""

VAR Arr2 = ""

VAR Arr3 = ""

VAR Arr4 = ""

VAR Arr5 = ""

Var Arr6 = ""

VAR Arr7 = ""

VAR Arr8 = "";

Var Arr9 = "";

Var arr0 = "";

Var str = new array ();

Str = C.Split (",");

For (i = 0; i

{

M = STR [I];

IF (n

S = M.CHARAT (PARSEINT (M.LENGTH) -N-1);

Else

S = 0;

Switch (PARSEINT (S))

{

Case 1:

Arr1 = Arr1 Str [I] ","

Break

Case 2:

Arr2 = Arr2 Str [I] ","

Break

Case 3:

Arr3 = Arr3 Str [i] ","

Break

Case 4:

Arr4 = Arr4 Str [I] ","

Break

Case 5:

Arr5 = Arr5 STR [I] ","

Break

Case 6:

Arr6 = Arr6 STR [i] ","

Break

Case 7:

Arr7 = Arr7 STR [I] ","

Break

Case 8:

Arr8 = Arr8 Str [I] ","

Break

Case 9:

Arr9 = Arr9 Str [I] ","

Break

Case 0:

Arr0 = Arr0 Str [I] ","

Break

DEFAULT:

Break

}

}

STRC = Arr0 Arr1 Arr2 Arr3 Arr4 Arr5 Arr6 Arr7 Arr8 Arr9;

Strlen = strc.length

Strc = strc.substr (0, Strlen-1);

Return strc;

}

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

New Post(0)