can u please explain me the problem,as on what basics we have to select the activity thats not mentioned in the problem…kindly explain me with a test case…
regards
Activity selection problem
All the activities have equal importance. You just need to select the max subset of activities so that they don’t overlap.
is this reply relevant…?? if yes then kindly tell me by a testcase example.(a small dryrun ).that ll be thankful…
Of course it’s relevant because the activities are equally important before you start to develop the solution as there are no prior weights associated with the activities.
But if you want to know the solution, then we sort the activities by ending time. And then pick them up greedily .
For example , lets say you have 3 activities,
1 7
2 5
6 10.
Now sorting them in ascending order of ending times gives us
2 5
1 7
6 10
So now we can greedily pick 2 activities, 2 5 and 6 10
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.