Module:greedy_algorithms()
Method : min_product_subset(arr,hint=False)
Uses : This method is used to return an integer p such that p is the minimum of the products of all the subsets.
Parameters : arr - an one dimensional array as python list,
hint is passed False by default, by declaring hint=True
a detailed description of the greedy algorithm can be found.
from edualgo import algorithms as al
ping = al.greedy_algorithms()
arr = [-1,-1,2,3,-1]
ping.min_product_subset(arr)
Output:
[-1, -1, 2, 3, -1]
-6
For getting the hint just pass hint=True in the function like - min_product_subset(arr,True).
Do you want to contribute to our project ? We welcome every python lover to come forwards and have some fun with our source code. Steps to contibute:
Keep coding, keep loving python