Hi, This is an allocation problem, where rules for allocation is given in ratio. These ratios are maintained in a 2-d matrix. While creating the ratios we do not have any restriction. So there is possibility of circular allocation, but infinite loop won't be there. Following is the example:
A is allocating to B, C, D in ratio 0.2, 0.4 and 0.4 A --> B 0.2 C 0.4 D 0.4 D is again allocating to E and A in ratio 0.6 and 0.4: D --> E 0.6 A 0.4 These allocation will end when allocation to X, Y and Z happen. C, D and E is allocating to X, Y and Z respectively in ratio 1. Now we need to find out an allocation of $100 starting from A. in what ratio other will get. Basic need to resolve the loop A --> D --> A. [It is given that there will not be infinite loop. Means A -- > B 1 --> A 1 won't be there.] There won't be any allocation if its less then 0.000000001. Right now I am using: 1. Starting allocation from A. Divide among all sub parts. Add each separately in a queue. 2. Get first item from queue. If its allocated to X, Y, or Z then insert into separate storage queue. Else If value greater then 0.000000001 then divide and insert into queue. 3. Repeat steps one and two till queue is empty. Please suggest the solution that can fit in loop of any level down. -- With Best Regards... ----------- Manish --~--~---------~--~----~------------~-------~--~----~ 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, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---