I have a list
of randomly generated numbers (let's call it numbers
). I have another list
of int
of the same number of elements (I'll call it positions
). The purpose of positions is to store the ordinal positions of the element. How do I go about this?
This is what I have thought about it:
numbers
called copy
numbers
(sort of)copy
copy
positions
The second step is what I don't know how to go about.
I'm not sure if what I have thought is the best. So I'll actually prefer a better implementation of this.
Follow these steps:
int
, for Example Tuple<int,int>
numbers
create a pair with the number and an increasing indexpositions
in the second int of your sorted pairs