Showing posts with label Searching. Show all posts
Showing posts with label Searching. Show all posts

Saturday, April 9, 2011

Find Minimum element in sorted but rotated array

Input:
6 5 4 2 3
Output:
Elements in the array:
6 5 4 2 3
Min:2


Code:

Find an element in a matrix, whose rows are sorted left to right and cols are sorted top to bottom

Input:
3
3
1 2 3
4 5 6
7 8 9
7
Output:
1 2 3
4 5 6
7 8 9
KEY:7
Key Search? true


Code: