mojoman
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
int getFirstOccurance(int[] sortedArr,int first,int last,int s)
{
if(first > last) return -1;
int mid = (first + last )/ 2;
if(sortedArr[mid] == s && (sortedArr[mid-1] != s || mid -1 == 0) )
return mid;
if(sortedArr[mid] >= e)
return getFirstOccurance(sortedArr,mid+1,last,s);
return getFirstOccurance(sortedArr,fist,mid-1,s);
}
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
// call updateNode(s) where s is root of tree to be updated. This is under assumption that only right most nodes of the tree are to be updated with the inorder successor
- mojoman May 30, 2013