[algogeeks] Re: cormen problem

2008-06-11 Thread Douglas Diniz
This is the trivial case. There is only one tree with 0 nodes. But you can prove by contradiction if you like. On Wed, Jun 11, 2008 at 3:12 AM, zee <[EMAIL PROTECTED]> wrote: > > referring to problem 12-4 of CLR > > how does we show that b0 ( the number of binary trees formed by 0 nodes is > 1) >

[algogeeks] Re: Cormen Problem

2006-02-15 Thread Gene
This is the idea my code used, though I kept track of the start of the array with a pointer and the end with an integer length. You seem to imply that the median of an array is always a single element (at n1 or n2). Care is necessary when the lengths of the arrays are even. In this case the med

[algogeeks] Re: Cormen Problem

2006-02-15 Thread rohit
Hello all, thanks for providing some solutions, this is the solution to the problem that I had given earlier although a informal one let the two arrays be A1 and A2 with p1, q1 he start and end of the first array and p2, q2 be the start and end of the second array. let n1 be the median of the fi

[algogeeks] Re: Cormen Problem

2006-02-10 Thread Gene
Just noticed again that I made a silly algebra error and this code doesn't work right when the operands are of even length. Sorry. If anyone is interested I'll work out the correction.

[algogeeks] Re: Cormen Problem

2006-02-08 Thread Gene
I just noticed that the problem requires the arrays to be the same length. Obviously I solved it for different lengths.

[algogeeks] Re: Cormen Problem

2006-02-08 Thread Gene
Here's one (untested). Suppose the two arrays are a and b and WLOG |a| <= |b|. First consider the "divide and conquer" step where |a| > 1 (and therefore |b|>1 also). Let A be the middle element of a and B the middle element of B. Then there are two cases that let you throw away |a|-1 elements

[algogeeks] Re: Cormen Problem

2006-02-08 Thread luciferleo
why not post your answer here by the way?

[algogeeks] Re: Cormen Problem

2006-02-08 Thread rohit
I already found the solution on this group only. Thanks a lot. And no its not homework Thanks Rohit

[algogeeks] Re: Cormen Problem

2006-02-07 Thread Gene
This is a slick problem. Is it homework?