how can i make a function that accepts as input a vector of integers, which will return the largest and the second largest component of the vector for the first i think that is max1=max(max(C)) any idea for max2?
No products are associated with this question.
Do you mean the maximum over a matrix (see tags and example max(max(C))) or over vector (body of the question)?
Alternative, which is slower due to the expensive sorting for large inputs:
Which values should be replied, if the highest maximum is not unique?
[EDITED: Sorry, I've overseen that this is a homework!]
Play games and win prizes!Learn more