[algogeeks] Re: water-jug problem

2012-04-02 Thread Don
I did that by building a tree in which each node stores the configuration, including number of steps to that point, amount of water in each bucket, and a pointer to the parent, sibling, and leftmost child. Start out with one node with stepCount set to zero and all the buckets empty. You want the so

[algogeeks] Re: need suggestions

2012-04-02 Thread Don
No. The 15th processor starts with those 4 items already in the knapsack. This makes it a smaller problem because you don't have to consider cases where those 4 items are not in the knapsack. Similarly, processor 0 starts with none of those 4 items in the knapsack and does not consider any combinat

[algogeeks] Re: water-jug problem

2012-04-02 Thread vinay bajaj
http://www.cut-the-knot.org/wgraph.shtml Every distribution of wine in the three jugs A, B, and C, can be described by the quantities b and c of wine in the jugs B and C, respectively. Thus every possible distribution of wine is described by a pair(b, c). Initially b=c=0 so that one starts wi

[algogeeks] Re: m*n matrix, sorted rows, sorted columns, WAP to find an element efficiently

2012-04-02 Thread vinay bajaj
This search can be done easily in O(n+m) start from top right corner. chek out this link you will understand!! http://www.geeksforgeeks.org/archives/11337 On Sunday, 1 April 2012 21:18:26 UTC+5:30, ashgoel wrote: > > -- You received this message because you are subscribed to the Google Groups