[algogeeks] Re: data structure for median

2008-07-06 Thread Balachander
How Do u basically find the Median of BST in place ? Are u trying to find the median just by traversing once ? / Bala --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, se

[algogeeks] Re: diameter of a graph

2007-06-20 Thread Balachander
Hi all I dint get that one straight. Diameter is the dist. btw 2 farthest nodes la. ? So . wheres the Qn of pendant vertex and other stuffs come. ? Pls explain ur Soln ? -- Bala --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

[algogeeks] Re: interesting collinear Points problem

2007-05-14 Thread Balachander
Hey.. How can reduce the Comp from O(n) to O(log n) How are arranging the lines [ nC2 lines] for the purpose of finding the max no of collinear points For finding all lines O(n^2) For Checking the presence ..O(n) Pls reply ,,How can u reduce the comp to Log n. Bala On May 14, 6:57 pm, "[EMAIL

[algogeeks] Re: another graph problem

2007-05-07 Thread Balachander
@Jeth Hi Just thot a Soln Since we need to check whether the length of any path btw any two nodes in a grph it s enough if we checkwhether the Height of DFS tree [/Forest] is max of 2. If so then the ttask underlying is accomplished. Notify if my intution s not crt Open 4 comments Regards

[algogeeks] Re: Maximum Product Contiguous Subarray

2007-04-26 Thread Balachander
Hi Think thats not, possible Is ur soln : this way Arr : a[1 ...n] New Arr = newRR[ loga[i] .log[an] ] and Finding the max sum.. If so it ca be done as OLog is not defined for negative numbers .. Bala On Apr 26, 9:24 am, Arunachalam <[EMAIL PROTECTED]> wrote: > Multiplication can be convert

[algogeeks] Re: A cycle with minimum length

2007-04-02 Thread Balachander
Hi Try to Elaborate the Explanation ..plss --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, se

[algogeeks] Re: print n bit numbers in binary format..

2007-03-21 Thread Balachander
int *p; void PrintallComb(int i) { int j=0; if(i == nBits) { for(j=0;jhttp://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---

[algogeeks] Re: count the 1 bits in integer

2007-03-21 Thread Balachander
Hi,, Think the No of 1 bits can be found in o(k) where k is the no of bits set while((n & (n-1)) >= 0) { c++; n = n & (n-1); printf(">> n %d Cnt %d \n",n,c); if(!n) break; } printf("Cnt %d \n",c); --~--~-~--~~~---~--~

[algogeeks] Re: find the closest common ancestor of node u and v?

2007-03-20 Thread Balachander
Hi.. Think Ur Algo Will work only when u and v are at equal height frm their Common ancestor 'P' So U need to think of all possibilities Node* ClosestCommonAncestor(Node* u, Node* v) { if(! u && v ) return NULL; if( u == v) return u->parent; x = ClosestCommonAnce

[algogeeks] Re: To find a rectangle of max sum

2007-03-12 Thread Balachander
Can we MAP this variant to Finding the largest Bound rect in a BAR graph..? Think so. I can be done by Iterative Usage of the Same algo(as Bar grph) at evry row from Bottom. Open for Suggestions ... On Mar 12, 11:40 pm, "Karthik Singaram L" <[EMAIL PROTECTED]> wrote: > Another variant...(or rat

[algogeeks] Re: Inplace sorting

2007-03-12 Thread Balachander
HI na, Thought of Heaps. FIXHEAP is O(n) Can we use Fix heap so that the Array obeys Heap's shape and value property.. Then We can disp .Level order Traversal. Note : But i am not sure about the Shape of givn Binary tree,,:) Waht has to be dne if it doesnt obey Heap's Shape property On Mar 13,

[algogeeks] To find a rectangle of max sum

2007-03-12 Thread Balachander
How to find the Rectangle of Max sum in a 2D matrix consisting of both +ve and -ve numbers,,, Logic needed .. No brute Force pls... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post t

[algogeeks] Largest Bound rectangle in a bar graph

2007-03-12 Thread Balachander
1. How to find the largest bound rectangle in a bar graph It seems a Google question was to solve this in O(Log n) Try any Soln..and Post it.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" gro