The values of a function of two variables z = f (x, y), where x, y, z take integer values are stored in sql db. Calculate (appoint) the largest surface area of the flat. By 'flat area' we mean an area about which for each pair of x and y lying inside the area about the value of the function is constant (z = const).
I have already tried to use this flood fill algorithm, but I am not sure if this is the right way. e.g. if I have pairs(x,y) as follows: (0,0),(0,2),(2,0),(2,2) for which z equals to 5(z=const) and have point (1,1) where z=1 - how should I compute "flat area"?