Ideally, I would like to be able to have 2 arrays. The first one would be an array of integers, like: n[0] = 30000; n[1] = 650; n[2] = 3; ...up to around 50 values or so.
And I need to find the fastest(most efficient, and hopefully capable of using registered variables) to be able to get the index from array of values using a value, like: x[30000] = 0; x[650] = 1; x[3] = 2;
This seems like it would be an associative array (which I would need another lib for), but it seems like such a simple thing that I cannot believe the capabilities aren't already there. I will only be working with 50 values or so, so making an array of 30001 in this case, just to be able to map one integer to another, would be ridiculous.
Can anyone tell me the best way to map one int to another int, keeping in mind there will be no more than 50, and not loop-checking each one for a match? Thanks for your help!
Aucun commentaire:
Enregistrer un commentaire