how about this??
*int maxinterval(int a[],int i,int j)
{
if(i==j)
return 0;
int max1 = 0,max2;
max2 = maxinterval(a,i+1,j);
while(i<j)
{
if(a[i]<a[j])
{
if(j-i)>max1)
max1 =j-i;
}
i++;
}
return(max1>max2?max1:max2);
}
*
On Mon, May 16, 2011 at 11:36 AM, anuj agarwal <[email protected]>wrote:
> How about create a BST and then, for each node find the difference between
> the node and its child and do this for all except leaf nodes.
> If u want i will write the code for the same.
>
> Anuj Agarwal
>
> Engineering is the art of making what you want from things you can get.
>
>
> On Mon, May 16, 2011 at 11:20 AM, anshu mishra <[email protected]
> > wrote:
>
>> @amit ur code is wrong. just check it for this {5, 4, 1, 8, 4, 4};
>>
>> --the
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
PIYUSH SINHA
9936757773
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.