Will this work ? Order by choosing the last element of the permutation first.
initially Calculate T = Total time of all tasks and calculate for all i, (T-Ti)*Ci and choose the task with min among them as last. To find the next last element , re-calculate T = T-Ti(i being the element chosen in prev step) and proceed with the same steps as mentioned above. On Tue, Jun 7, 2011 at 6:43 PM, ross <jagadish1...@gmail.com> wrote: > @Aakash Johari: > Sorting works fine if all jobs can be completed in a day.. > I have a modification to this question - > suppose the time to do a job is not one day and is given as Ti for job > i, then how should one solve it? > > > On Jun 7, 11:58 am, Aakash Johari <aakashj....@gmail.com> wrote: > > yes, it's correct. simply sort according to their costs (in decreasing > > order) > > > > On Mon, Jun 6, 2011 at 11:52 PM, sunny agrawal <sunny816.i...@gmail.com > >wrote: > > > > > > > > > > > > > > > > > > > > > Sort in decreasing order of Ci ? > > > > > On Tue, Jun 7, 2011 at 8:22 AM, aanchal goyal < > goyal.aanch...@gmail.com>wrote: > > > > >> Given n jobs, each ith job has a cost Ci associated with it. The > waiting > > >> time for a job i is defined as Ci*Delay, where Delay is the number of > days > > >> it takes from the first day to complete a job. Assume each job can be > > >> completed in 1 day. So, a job started at day 1 will have delay=1, the > one > > >> started at day 2 will have delay=2, etc. Order the jobs in such a way > that > > >> waiting time is minimum. > > > > >> -- > > >> Regards,* > > >> Aanchal Goyal*. > > > > >> -- > > >> 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. > > > > > -- > > > Sunny Aggrawal > > > B-Tech IV year,CSI > > > Indian Institute Of Technology,Roorkee > > > > > -- > > > 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. > > > > -- > > -Aakash Johari > > (IIIT Allahabad) > > -- > 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.