typedef struct { int x; int y; } Point_t;
typedef struct { Point_t left_up; int right down; } Rectangle_t;
I have this function:
double maxSumConstPoint(double table[][COL_COUNT], int nRow, int leftUpY, int leftUpX, int* rightDownY, int* rightDownX){
int rDX; /*x coordinate of the right down corner of the rec*/
int rDY; /*y coordinate of the right down corner of the rec*/
double temp;
/*initialize the rectangular with the one including only one point*/
double sum=table[leftUpX][leftUpY];
*rightDownY=leftUpY;
*rightDownX=leftUpX;
/*Try all feasible rectangulars by changing the right down corner*/
for(rDY=leftUpY; rDY<nRow; ++rDY){
for(rDX=leftUpX; rDX<COL_COUNT; ++rDX){
temp=getSum(table, leftUpY, leftUpX, rDY, rDX);
if(temp>sum){
/*a better rectangular is found, perform an update */
sum=temp;
*rightDownY=rDY;
*rightDownX=rDX;
}
}
}
return sum;
}
I need to turn the following functions:
Rectangle_t maxSumConstPoint(double table[][COL_COUNT], int nRow, Point_t
left_up)
How can write this function?
Aucun commentaire:
Enregistrer un commentaire