int main() { MedianFinder medianFinder; medianFinder.addNum(5); medianFinder.addNum(14); medianFinder.addNum(25); cout << medianFinder.findMedian(); }
int main() { MedianFinder mf; mf.addNum(2); cout << mf.findMedian(); mf.addNum(3); cout << mf.findMedian(); }
// Your MedianFinder object will be instantiated and called as such: // MedianFinder mf; // mf.addNum(1); // mf.findMedian(); int main(int argc, char** argv) { int n; MedianFinder mf; cout << "plz input a char: " << endl; while (cin >> n && n != -1) { mf.addNum(n); cout << "median: " << mf.findMedian() << endl; } return 0; }
int main() { MedianFinder m; int n; cin >> n; int x; cin >> x; m.addNum(x); while (n--) { cin >> x; m.addNum(x); cout << m.findMedian() << endl; } return 0; }
int main() { srand((unsigned int)time(NULL)); vector<int> v; MedianFinder m; for (int i = 0; i < 3000; ++i){ v.push_back(rand() & ((1 << 14) - 1)); m.insert(v.back()); } cout << m.getMedian() << endl; cout << getMedianSlow(v) << endl; //print(v); }
int main(int argc, char *argv[]) { MedianFinder mf; mf.addNum(6); cout << mf.findMedian() << endl; mf.addNum(10); //mf.print(); cout << mf.findMedian() << endl; mf.addNum(2); //mf.print(); cout << mf.findMedian() << endl; mf.addNum(6); //mf.print(); cout << mf.findMedian() << endl; return 0; }
int main(int argNum, char* args[]) { MedianFinder finder; // finder.buildMinHeap(); // // cout << "----------" << endl; // finder.buildMaxHeap(); // finder.test1(); int size = 14; // int originArr[] = {1,2,3,4,5,6,7,8,9,10}; // int originArr[] = {-1,-2,-3,-4, -5}; int originArr[] = {78,14,50,20,13,9,25,8,13,37,29,33,55,52}; for(int i = 0; i < size; i++) { finder.addNum(originArr[i]); } // finder.addNum(29); double r = finder.findMedian(); cout<< r<<endl; cout<< "main funciton end"<<endl; return 0; }
int main() { MedianFinder mf; mf.addNum(1); mf.addNum(2); cout << mf.findMedian() << endl; mf.addNum(3); cout << mf.findMedian() << endl; return 0; }
int main() { MedianFinder MF; MF.addNum(1); cout << MF.findMedian() << endl; MF.addNum(3); cout << MF.findMedian() << endl; MF.addNum(2); cout << MF.findMedian() << endl; system("pause"); return 0; }
int main() { MedianFinder mf; double r = 0; mf.addNum(1); r = mf.findMedian(); mf.addNum(2); r = mf.findMedian(); mf.addNum(3); r = mf.findMedian(); mf.addNum(10); r = mf.findMedian(); mf.addNum(5); mf.addNum(11); r = mf.findMedian(); return 0; }