cs クラスにソートアルゴリズムの割り当てがあります。Radix Sort の疑似コードを c++ に変換する必要があります。ここに私の疑似コードがあります:
radixSort( int theArray[], in n:integer, in d:integer)
// sort n d-digit integers in the array theArray
for (j=d down to 1) {
Initialize 10 groups to empty
Initialize a counter for each group to 0
for (i=0 through n-1) {
k = jth digit of theArray[i]
Place theArray[i] at the end of group k
Increase kth counter by 1
}
Replace the items in theArray with all the items in
group 0, followed by all the items in group 1, and so on.
}
問題は、「グループ」の意味がよくわからないことです。最初に配列を処理しようとしますが、もちろん、数値をオーバーライドします。最後の桁に従って数字をグループ化するにはどうすればよいですか? 私はコードを求めていません。私はただ理解する必要があります。どうもありがとうございました。