Continuous Median Time : O(logn) for insert O(1) for getMedian Space : O(n) 123456789101112131415161718192021222324252627using namespace std;// Do not edit the class below except for// the insert method. Feel free to add new// properties and methods to the class.class ContinuousMedianHandler {public: priority_queue<int> less; priority_queue<int, vector<int>, greater<int>> greater; void insert(int number) { greater.push(number); while(greater.size() > less.size()) { less.push(greater.top()); greater.pop(); } } double getMedian() { if(less.empty()) return -1.0; if(greater.size() == less.size()) { return (greater.top() + less.top()) / 2.0; } return less.top(); }};