WeBeginners-Community / DocBook

Documentations of Html to every open source technologies. It's a low-code repository
30 stars 54 forks source link

Greedy Method-Activity Selection Problem #111

Closed shailja2727 closed 1 year ago

shailja2727 commented 1 year ago

Is your feature request related to a problem? Please describe.

It is classic Greedy Problem .In activity selection problem we always pick the next activity whose finish time is the least among the remaining activities and the start time is more than or equal to the finish time of the previously selected activity. We can sort the activities according to their finishing time so that we always consider the next activity as the minimum finishing time activity.

I will do it C,C++,JAVA,Python

Describe the solution you'd like.

i)Sort the activities according to their finishing time ii)Select the first activity from the sorted array and print it ii)Do the following for the remaining activities in the sorted array If the start time of this activity is greater than or equal to the finish time of the previously selected activity then select this activity and print it

Describe alternatives you've considered.

I have used different function of libraries to create pair of start and end time. Using C,C++,Java,python the algorithm is being done by me.

Add any other context or screenshots about the feature request here.

The Output will be like this: image Please assign this to me