sdreamjain
BAN USER@R
so you are saying we should create min heap for each process ?
I think its a best fit algorithm problem in which a number of processes are given and some memory blocks are given and we have to find the best fit memory block for a problem.
There might a more efficient way to slove this problem but i would like to solve this problem with the help of linked list and a array.
Lets suppose we have a linked list whose each node representing the memory space of each data center. Take your first example .
Servers capacity limits: 8, 16, 8, 32
Tasks capacity needs: 18, 4, 8, 4, 6, 6, 8, 8
Linked list : 32->16->8->8
array : 18,4,8,4,6,6,8,8
Now i will search best fit memory space (which is wasting minimum memory space after acqureing required space)of each process .
18 :
14->16->8->8
16->14->8->8
4:
16->14->4->8
16->14->8->4
8:
16->14->4
4:
16->14
6:
16->8
6:
16->2
8:
8->2
8:
2
@Solomon Yang
- sdreamjain August 05, 2014In point of view giving a code directly for a problem is not going to be so much worthy , please give your algorithm and let the other code it. It will also give a better understanding of solution in quick time . Btw thanx for solution.