A
axcytz
Hi all,
I have an array containing 10 elements in it. I want to swap all elements (2 swap) with each other after each swap I will calculate a function value based on the updated array. So, I will have 45 different function values (10choose 2). I will store these values in another array and will get the index of the smallest valued array.
This is what i want to do.
include<algortihm>
My function:
for(int i=0 ; i< 45; i++)
{
for(int j=0; j<10; j++)
{
for(int k=0; k<10; k++)
{
UpdatedArray = swap(MyArray[j], MyArray[k]);
FunctionValue = Data[k]*Value[UpdatedArray]; //here the part after equal sign is not important for now.
}
}
}
Any help is appreciated, thanks!
I have an array containing 10 elements in it. I want to swap all elements (2 swap) with each other after each swap I will calculate a function value based on the updated array. So, I will have 45 different function values (10choose 2). I will store these values in another array and will get the index of the smallest valued array.
This is what i want to do.
include<algortihm>
My function:
for(int i=0 ; i< 45; i++)
{
for(int j=0; j<10; j++)
{
for(int k=0; k<10; k++)
{
UpdatedArray = swap(MyArray[j], MyArray[k]);
FunctionValue = Data[k]*Value[UpdatedArray]; //here the part after equal sign is not important for now.
}
}
}
Any help is appreciated, thanks!