My algorithm uses a function like .......
insert
Code:
long double E(int x1, int x2, int x3, int x4, int x5)
// x1..x5 start from 1 and go upto few thousand (2,500)
{
decoding of x1,x2,x3,x4,x5 takes place ......
and parmeters are chosen from the problem data set
for(int l=1; l<5; l++)
for(int i=1; i<5; i++)
{
case 1:
long doubel f1( parameters of xi )
{
long double g1( parameters of xi ) ;
long double h1( parameters of xi ) ;
................
}
case 2:
long doubel f2( parameters of xi )
{
long double g2( parameters of xi ) ;
long double h2( parameters of xi ) ;
................
}
case 3:
long doubel f1( parameters of xi )
{
long double g1( parameters of xi ) ;
long double h1( parameters of xi ) ;
................
}
}
}
that is the function is complex and involves further calls of other funtions
A number of sets {x1,x2,...,xn} are produced during the program run for which the function E() has to be evaluated. The problem is that a set of values of {x1,x2,...,xn} may repeat itself again & again. And it is unnecessary to compute the function value for the same set of values as the value will be the same with only the additional computation time. And computation time has to be minimized for efficient programming.
How can i do this ..............
Somebody told me that hashing can be used here ..... but i don't know whether he is right or not as i have never done hashing ......... it is not known to me .....
Can anybody suggest me a simple way to avoid calling the same function for duplicate sets of values ..... in order to save computation time.?