florinpop17 / app-ideas

A Collection of application ideas which can be used to improve your coding skills.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fractional Knapsnack Problem - A dive into Greedy Approach

deepakrawat-19 opened this issue · comments

Is your feature request related to a problem? Please describe.
You want to paint your house. The total area of your house is D units. There are a total of N workers. The ith worker is available after time Ti, has hiring cost Xi and speed Yi. This means he becomes available for hiring from time Ti and remains available after that. Once available, you can hire him with cost Xi, after which he will start painting the house immediately, covering exactly Yi units of house with paint per time unit. You may or may not hire a worker and can also hire or fire him at any later point of time. However, no more than 1 worker can be painting the house at a given time.
Since you want the work to be done as fast as possible, figure out a way to hire the workers, such that your house gets painted at the earliest possible time, with minimum cost to spend for hiring workers.
Note: You can hire a previously hired worker without paying him again.

Describe the solution you'd like
The above Problem is a good and efficient example of Fractional Knapsnack Problem.
We will be using Greedy Approach to solve this problem which will help the learners learn a new concept more precisely

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

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

ezoic increase your site revenue