Thursday, July 22, 2010

Basic interview question

Do not come to me if you don't know how to answer it!!

how to search a number in a 2d matrix which is sorted both row wise and column wise

2 comments:

  1. Even Write a C code to reverse a linked list falls under this category. :)

    ReplyDelete
  2. 1. Start at bottom left corner of the array.
    2. Move right if the element is bigger otherwise move up if the element is smaller.
    3. Repeat the above step till match is found or top-right is reached.

    ReplyDelete