class Solution { public: vector<double> vec; void Insert(int num) { vector<double>::iterator it; for(it=vec.begin();it!=vec.end();it++){ if(*it>=num){ vec.insert(it,num); return; } } vec.push_back(num); return; } double GetMedian() { if(vec.size()%2==1){ return vec[vec.size()/2]; } else{ return (vec[vec.size()/2]+vec[vec.size()/2-1])/2; } } };