endeav.rd
BAN USER
Comments (10)
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.
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.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
The next largest number is giong to be the smallst element of the tree rooted at its right child. Say the given number is at index i, get the right child from arr[2i+2]. New index is j = 2i+2;
- endeav.rd July 24, 2010keep looking for leftmost child arr[2j+1] untill arr[2j+1] is invalid. Next largest number would be arr[j];
But this is not in constant time :(