Well, first of all, my question is directly related with computer science and some mathematics, rahter than programming. Suppose that i have 4 values which are for example 100,200,300,400, and those values directly map to an array index that correspond to different actions (functions) to being taken by the software. Rather than doing this with switch case or if case (since it may be a lot more) i want to point the functions at the proper locations of the array. At this point my question is that if it is possible to map those non-adjacent values mentioned above to the adjacent values, for the purpose of minimizing the size of the array, with a specific hashing function that will work like;
f(100) = 0
f(200) = 1
f(300) = 2
.
.
.
( note that f function should be invertible) Thanks.