Ok, so I need to create a radix collation for unsigned and floating point numbers. My version of unsigned ints works as it should, I have a little problem with the fact that it works for floating point values. It basically sorts the values โโof my array into the integer numeric value of the floating point number, but does not sort it based on the decimal value. (Example 36.65234 will appear before 36.02311 if it is the first in an unsorted array) This code segment is where I do my manipulations and masking bits, and I'm sure this is my problem.
for(int i=0; i<n; i++){ temp_int = (((unsigned int)(list[i]))>>bitwise)&0xff; bin[temp_int] = bin[temp_int]+1; } for (int i=0; i<256; i++) { map[i+1] = bin[i]+count; count = map[i+1]; } for (int i=0; i<n; i++) { temp_int = (((unsigned int)(list[i]))>>bitwise)&0xff; int buf_loc = map[temp_int]; temp_arr[buf_loc] = list[i]; map[temp_int] = map[temp_int]+1; }
Thanks in advance!
source share