row number is in range , column number is in range and value is 1 and not yet visited
return ( row >= 0 ) && ( row < ROW ) && ( col >= 0 ) && ( col < COL ) && ( M [ row ] [ col ] && ! visited [ row ] [ col ] ) ; }