From 1f4a993e491fa3dd011a603353ca336fe996a068 Mon Sep 17 00:00:00 2001 From: Piyush Maurya <34208835+piyushkrmaurya@users.noreply.github.com> Date: Sun, 3 Oct 2021 21:55:41 +0530 Subject: [PATCH] N delivery executives and N orders Given a NxN cost matrix, we need to assign each order to an executive in such a way that the total cost is minimum. --- bit_manipulation/orders.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bit_manipulation/orders.py diff --git a/bit_manipulation/orders.py b/bit_manipulation/orders.py new file mode 100644 index 000000000000..56b06cd63fee --- /dev/null +++ b/bit_manipulation/orders.py @@ -0,0 +1,24 @@ +def count_set_bits(n): + count = 0 + + while (n): + n &= (n-1) + count += 1 + + return count + +def assignment(cost): + f = [float("Inf")]*(1<