hi, I'm using this bubble sort to sort the elements in my array right now, but I need something faster.
bSorted = false;
while(!bSorted)
{
bSorted = true;
for(int e = a_count - 2; e >= a_lbound; e--)
{
if(a_edges[e + 1].B < a_edges[e].B)
{
bSorted = false;
tmpEdge = a_edges[e];
a_edges[e] = a_edges[e + 1];
a_edges[e + 1] = tmpEdge;
}
}
}
I want to use a radix sort, but I'm not sure how to do it with anything but a list of numbers.
struct EDGE
{
int poly;
double inv_slope;
int B;
POINT3D p1, p2;
};
I want to sort this struct by "B", but there can be more than one instance with the same value for "B" and different value for "poly" for example. I can't then create an array of integers and add 1 to intarray[5] if "B" is 5, for this reason.
can someone point me in the right direction on how I would sort such a thing quickly?
thanks, Nicolas