Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Arrays

I was wondering if anyone knows how to find the median of an array? I already sort the array just need to know to use what I sort to help find the median.

4th Jul 2019, 10:56 PM
Beanie
Beanie - avatar
6 Answers
4th Jul 2019, 11:48 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
You can just use the basic statistic method, the (n + 1)/2 to find the index.
4th Jul 2019, 11:11 PM
Agent_I
Agent_I - avatar
+ 4
The middle element of a sorted array.
5th Jul 2019, 2:22 AM
Sonic
Sonic - avatar
+ 3
#Python import statistics listA =[12,32,56,67,88] print(statistics.median(listA))
4th Jul 2019, 11:18 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
+ 3
i need it for java
5th Jul 2019, 2:36 AM
Beanie
Beanie - avatar
+ 1
Guys can someone help me to understand the Array thing please
30th Dec 2021, 6:10 PM
STANLEY CHIHURI
STANLEY CHIHURI - avatar