yes, i agree, and that is why i called my soln as naive,

i want to understand the logic for the solution(wht interval tree, what is
done inside the for loop with ans assignmetn) because no one can go and
write this solution in an interview without an explanation :)

Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Thu, May 26, 2011 at 6:07 AM, Anand <anandut2...@gmail.com> wrote:

> @Ashish: complexity for your solution is O(n*Total seconds)
>
>
>
> On Wed, May 25, 2011 at 5:25 PM, Ashish Goel <ashg...@gmail.com> wrote:
>
>> 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.
>>
>
>  --
> 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.

Reply via email to