/* Optimal Binary Search Tree */ #define MAX_FREQ 1.0e38 #define C(i,j) cost[i*(n+1)+j] #define BEST(i,j) best[i*(n+1)+j] int *opt_bin( double *rf, int n ) { int i, j, k; int *best; double *cost, t; /* Allocate best array */ best = (int *)calloc( (n+1)*(n+1), sizeof(int) ); /* Alocate cost array */ cost = (double *)calloc( (n+1)*(n+1), sizeof(double) ); /* Initialise all sub-trees to maximum */ for(i=0;i