Hi everyone i'm working on c and my code looks like this, basically it's an array and in every array[j] there is a number from 1 to 8, not in order and i'm trying to find where 1 is, and do some operations, then find 2 and do other operations etc.. till number 8:
for(i=1;i<9;i++)
for(j=0;j<8;j++)
if(array[j]==i)
//and operations to do but they are not needed now;
I'm trying to find another way of doing this with less time spent in the cycle as the complexity can be (n^2). Someone advided me a hasing system to order things but i don't know if it's good enough. Thanks to everyone!