Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Don't know how to interpret an algorithm exercise with matrices!

elika91elika91 Posts: 1Member
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
same value.
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.
Sign In or Register to comment.