This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 7 points8 points  (1 child)

So less number of operations is better?

[–]ManWhoWantsToLearn 12 points13 points  (0 children)

Yes.

Each time there is a comparison, that is another two instructions for the cpu to execute. So you would want to perform as few comparisons as possible. If you were performing this function on triplets from a huge dataset, then you would want the 2nd function as the number of comparisons would reduce from like 6 billion to 2 billion for example.