Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Each graphics subsystem is usually compiler & system dependent. Can you give some more
infos( e.g. on which 'different' system did it work)?
2:
I remember there are various methods to sort linked lists. I know a quite simple method, it isn't
the fastest i think ...
a) Assign all your linked list items some sort of hash value which is sort order dependent,
perhaps like this:
unsigned long buildHash(char *text)
{
unsigned long ulValue=0;
int nPos;
for(nPos=0;nPos<4;nPos++) {
if(text[nPos]==0) break;
ulValue |= ((unsigned char)text[nPos])<<((3-nPos
}
return ulValue;
}
// example: HELLO -> 0x48454c4c
Then define a struct which takes the linked list item and its hash value:
struct _helper {
linkedlistitem *item;
unsigned long hash;
};
Build an array so that each linked-list item is contained, and then you can use the qsort()
function of C( or the STL implementation).
Then you can either use a bubble sort on the linked-list items which have the same hash
value - or you can proceed like above, assign those items with the same hash value a new
array, where the hash value starts with the 4th character.
In the worst case (all items are identical), you'll get O(N*N), in the best case, where all
(first) hash values are different, you'll get O(N).