I am trying to create a function that asks the user to input 5 scores, drops the highest and lowest score, and then averages the 3 remaining scores. I am not sure how to get the function to drop the highest and lowest scores, can anyone help?
Sorting will generally be slower and incur a higher overhead, and you'd be calling stl algorithms for maximum efficiency anyway. In addition, sorting takes up memory space where as max/min is primarily comparison.
And why is sorting more logical than max/min? It causes modifications to memory, an overhead not necessary or incurred by a max/min algorithm, and thereby slowing down further. Unless you have such a specific situation that you need to program the code for the algs yourself, max/min is going to be easier, faster and less code than sorting, followed by taking it out, because that is NOT what the algs do.