Asked • 03/18/19

Fastest way of finding the middle value of a triple?

Given is an array of three numeric values and I'd like to know the middle value of the three. The question is, what is the fastest way of finding the middle of the three? My approach is this kind of pattern - as there are three numbers there are six permutations: if (array[randomIndexA] >= array[randomIndexB] && array[randomIndexB] >= array[randomIndexC]) It would be really nice, if someone could help me out finding a more elegant and faster way of doing this.

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.