[algogeeks] Sum of weights

2013-09-11 Thread Azhar Hussain
We are given struct NodeProp { int id; int parent_id; int weight; }; Example: 100 {parent_id: -1, weight: 5} | 10 {parent_id: 100, weight: 3} | 5 {parent_id: 10, weight: 2} We have to print the sum of weights for each id For example if the id=5 parent_id- 10 and weight = 4 then id = 10

Re: [algogeeks] Find the max element of sets of size K

2013-09-11 Thread kumar raja
I heard there exists a O(n) algorithm in DP? Does anyone has the idea about it? On 11 September 2013 03:21, Aaquib Javed aaquib8...@gmail.com wrote: http://www.geeksforgeeks.org/maximum-of-all-subarrays-of-size-k/ On Tue, Sep 10, 2013 at 11:46 PM, kumar raja rajkumar.cs...@gmail.comwrote: