This is an exercise from my Informatics course:
Create an algorithm which finds if the minimum of two diagonals is the
same element of a square matrix with N x N elements.
I have no problem with creating the algorithm, once I find the correct
interpretation of the exercise.
The professor doesn't give any further clues.
I thought of these interpretation possibilities (assuming the first
diagonal is [a11,a22,a33,a44,a55...ann] and the second is [a1n,
a2(n-1), a3(n-2)...an1] ) :
1- Find the minimum of the first diagonal and then the second's and
compare them if they have the same value.
2- Do the same as above, but also check if they are the same element
(same indexes) which means if they are the intersecting element for
the two diagonals. This would work only if N would be an odd number.
If N is an even number the diagonals don't intersect.
3- Find the minimum of all elements of the two diagonals "joined"
together. Then find the minimum of the matrix. Check if they have the
4- Do the same as above, but also check if the minimum for both the
diagonals is the same element with the minimum of the matrix (check if
they have the same indexes).
What's your opinion? Judging by the way the exercise is expressed
which interpretation could me more possible? If there is any other
interpretation possible, what is it?
Thanks in advance.
0 · ·