for(col = col - 1; col >= 0; col--){
up = (myRow - 1 + numR) % numR;
dn = (myRow + 1) % numR;
upVal = totMat.val(up, col+1);
rowVal = totMat.val(myRow, col+1);
dnVal = totMat.val(dn, col+1);
if((upVal < rowVal) && (upVal < dnVal)){
totMat.setVal(myRow, col, upVal +
costMat.val(myRow,col));
dirMat.setVal(myRow, col, up);
}
else if(dnVal < rowVal && dnVal <= upVal){
// set totMat and dirMat}
else{// rowVal is largest,set totMat,dirMat
} } } }
Previous slide | Next slide | Back to first slide | View graphic version |