Tuesday, March 22, 2011

Searching a 2D Sorted Matrix Part I

Source

Problem

Write an efficient algorithm that searches for a value in an n x m table (two-dimensional array). This table is sorted along the rows and columns — that is,

Table[i][j] ≤ Table[i][j + 1]
Table[i][j] ≤ Table[i + 1][j]

No comments:

Post a Comment