Re: [algogeeks] Re: design_algo

2010-11-04 Thread kanika suri
@juver++.Thanx 4 rplyin. @mohit. I dont thnk so ur logic vl work in all cases. -- regards kanika suri MCS 2nd yr DUCS University of Delhi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegr

[algogeeks] Re: design_algo

2010-11-04 Thread juver++
Sorry for the second question. I've misread the problem and assumed that you have an array instead of BST. Locate minimum element in the tree - the leftist one in the tree. Then run 4 iterations for finding successors of the node. To do this you need to keep track link to the parent of the node. Ho

Re: [algogeeks] Re: design_algo

2010-11-03 Thread MOHIT ....
@kanika 1. Initialize: max_so_far = 0 max_ending_here = 0 Loop for each element of the array (a) max_ending_here = max_ending_here + a[i] (b) if(max_ending_here < 0) max_ending_here = 0 (c) if(max_so_far < max_ending_here) max_so_far = max_ending_here return

Re: [algogeeks] Re: design_algo

2010-11-03 Thread kanika suri
Thanx 4 rply but not getin ur solutions. 1.cn u gve easy algorithm(python dify to undrstand) 2.how to run selection sort on BST,BST has some different structure(dese algos run on arrays ).cn u gve code in C for undrstanding. -- regards kanika suri MCS 2nd yr DUCS University of Delhi -- You rec

[algogeeks] Re: design_algo

2010-11-03 Thread juver++
2. Well known problem and a simple solution: http://wuhrr.wordpress.com/2008/01/11/find-largest-sum-of-contiguous-numbers-in-an-array/ 1. a. Run 4 iterations of selection sort. b. Use quicksort based selection algorithm: http://www.ics.uci.edu/~eppstein/161/960125.html c. Use linear alorithm to fi