I was wondering if it was possible to find the median value of an array? For example, suppose I have an array of size nine. Would it possible to find the middle slot of this
In java :
int middleSlot = youArray.length/2; yourArray[middleSlot];
or
yourArray[yourArray.length/2];
in one line.
That's possible because in java arrays have a fixed size.
Note : 3/2 == 1
3/2 == 1
Resources :