Note that:
1. If the sorted median, so to sort the digital input
2. Note that the output is of type double
1 class solution { 2 public : 3 vector < Double > to; 4 void Insert ( int num) 5 { 6 aux.push_back (num); 7 } 8 9 dual GetMedian () 10 { 11 sort (aux.begin () aux.end ()); 12 int len = aux.size (); 13 if (len% 2 == 1 ) // 单数个 14 return Double(the [len >> 1 ]); 15 else 16 { 17 int sig = len >> 1 ; 18 Double med = (the [sig] + to [sig - 1 ]) / 2 ; 19 return med; 20 } 21 } 22 23 };