Java write, spit, and then want to use JS write, although more barren than Java, but at least can follow the sex.
<summary>
Map orignal indexes to sorted indexes, eg:si2i ([2,5,9,4,6,7]) =[0 (0,2), 3 (1,4), 1 (2,5), 4 (3,6), 5 (4,7), 2 (5,9)].
</summary>
<returns></returns>
public static int[] Si2i<t> (this list<t> s, Func<t, int> by) {
var r = new List<int> ();
var t = new list<t> (s);
while (R.count < S.count) {
var f = 0;
var v = by (t[0]);
for (var i = 1; i < T.count; i++) {
var n = by (t[i]);
if (n < v) {
f = i;
v = n;
}
}
var ts = t[f];
var II = s.indexof (TS);
while (R.contains (ii)) {
II = S.INDEXOF (TS, II + 1);
}
R.add (ii);
T.removeat (f);
}
return R.toarray ();
}
<summary>
Map sorted indexes to orignal indexes, see <see cref= "Si2i{t} (List{t}, func{t, int})"/>.
</summary>
public static int[] I2si<t> (this list<t> s, Func<t, int> by) {
Return si2i (si2i (S, by). ToList (), i = i);
}
}
Get the sorted subscript and the original subscript relationship