I need to take an array, and get the inverse of it (basically, just how you would take an inverse of a function in math). I'm kind of stumped. I need to do it where, if a[i] = x, b[x] = i. I would just copy from array a to array b in a function.
Unfortunately, not...I have to follow a function prototype that has a const array, regular array (where it would be copied to) and a numElements int.
Just thinking out loud, since the index would have to become the output, and then the output would become the index, I figure that I could run a loop, and then do something like:
for (int i = 0; i < elements; i++){
b[x] = i;
}
From there, I just have to get the order right (i.e. index), which would be the output of a[i].
Wow, thank you. That's definitely it. I had the output part down, but for whatever reason was stumped on how to get the output of b to be the index of a. That makes a lot of sense.
Yeah, I think I know what you mean...You're talking about if "b" has a very large value of one of it's numbers, like 1 million, "a" would need at least a million indexes.