2. [3 pts][Pointers + 2D arrays] Given a n*n square matrix. The task is to find the minimum sum of
n elements where each element should be in a unique row and column.
Example:
A = {
{5, 4, 4, 1},
{1, 3, 2, 4},
{3, 2, 3, 2},
{0, 4, 5, 4}
};
(0,0), (1,1), (2,2), (3,3) are 4 elements each of which is in a unique row and column.
The sum is 15.
whereas there are another set of 4 elements
(3,0), (2,1), (1,2), (0,3) each of which is in unique row and column.
The sum is 5.
The minimum among all the sets of similar 4 elements should be selected. Hence, 5 and the set
of elements that sums up to 5 is selected here. [That should be your program’s output.]
Note: For the simplicity, write a program that handles only 4x4 matrices.
Note: Bonus 1 pt if you have minimum sum and maximum sum using the same function at the
same time. I.e. The single function call should give us both the answers.
3. [2 pts][Pointers + Dynamic memory allocation] Implement the stack abstract data type
functionality. Stack is a LIFO data structure: Reading. The functions that you have to implement
are the following:
a. S_new - takes the size of the stack and generates it.
b. S_push - is used to add a new element on top of the stack
c. S_top - is used to read the topmost element
d. S_pop - is used to delete and return the topmost element
Notes: Pointers and Dynamic memory allocation can be used. But no struct or unions of C.
Task: After implementing functions, your program should be capable of creating two stacks and
take input from the user and fill the stacks.