Hi I was just thinking of a simpler solution
find sum of the time all processes will take, lets call that sum, say for 8,1,3,3,8 it is 23 walk over each process to see if this has been completely executed, if not set the out[i]=curTime and reduce the T[i] by 1.(out is the process final end time and T is the time process will take if run without halt i.e. 8,1,3,3,8) t=0; while (t<=sum) { for (int i=0;i<n;i++)//i represents total proc count { if (T[i]>0) {t++; out[i]=t; T[i]--;} } } I must say that this is naive solution I am not able to understand how interval tree and the code given by anshumishra6827 will work. Even if this is right, what was the rationale for using segment tree and what is the loop doing by playing with ans, D, L.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, May 25, 2011 at 2:24 PM, anshu mishra <anshumishra6...@gmail.com>wrote: > two thing i have forgot do; > > that is at every iteration > > rem--; > last = D[i-1]; > > -- > 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?hl=en. > -- 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?hl=en.