Fargushan
BAN USER
Comments (9)
Reputation 5
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote
1. arrange the rows of the matrix by its very first element.
2. take a 1D array a[], put a[0]=N[0][0],
3. now delete the N[0][0] elemt from the array, so that N[0][1] will become N[0][0]
4. Again sort the rows of the matrix by its very first element and again put the N[0][0] element in the 1D matrix and we can repeat this process recursively.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
-2
of 4 vote
We need to use matrix properties in this ques. start from any element in the matrix and compare with elements which is around that element, then move your pointer to the element which is more close to it then again repeat the process until you find the element.
- Fargushan October 01, 2012Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
ohh did not noticed the 2 arrays are sorted... then i would suggest to go for merge sort.
- Fargushan November 15, 2012if 1st array has a elements and 2nd array has b elements
then do merge sort till we reach (a+b-k)th element.
We can do it inplace based on the length on a & b.