*An MxN Young tableau is an MxN matrix such that the entries of each row are* *in sorted order from left to right and the entries of each column are in sorted order* *from top to bottom. Some of the entries of a Young tableau may be infinity, which we* *treat as nonexistent elements. Thus, a Young tableau can be used to hold r <= mn* *finite numbers.*

How to find an O(M+N) — time algorithm to determine whether a given number is stored in a given MxN Young tableau?

(source : Introduction to Algorithms)