MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __need

Method __need

other/bankers_algorithm.py:76–84  ·  view source on GitHub ↗

Implement safety checker that calculates the needs by ensuring that ``max_claim[i][j] - alloc_table[i][j] <= avail[j]``

(self)

Source from the content-addressed store, hash-verified

74 )
75
76 def __need(self) -> list[list[int]]:
77 """
78 Implement safety checker that calculates the needs by ensuring that
79 ``max_claim[i][j] - alloc_table[i][j] <= avail[j]``
80 """
81 return [
82 list(np.array(self.__maximum_claim_table[i]) - np.array(allocated_resource))
83 for i, allocated_resource in enumerate(self.__allocated_resources_table)
84 ]
85
86 def __need_index_manager(self) -> dict[int, list[int]]:
87 """

Callers 2

__need_index_managerMethod · 0.95
mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected