public class Solution {
private ArrayList<Integer> data = new ArrayList<>();
public void Insert(Integer num) {
data.add(num);
}
public Double GetMedian() {
Collections.sort(data);
int length = data.size();
if(length % 2 != 0){
return (double)data.get(length / 2);
}else{
return (double)( data.get(length /2 - 1) +data.get(length / 2)) / 2;
}
}
}