#include #include "Heap2opt.h" int main() { Heap2opt h2; for ( int i = 0; i < 50; ++i ) { if ( h2.size() == 50 ) { std::cout << "-" << '\t'; h2.pop(); } else if ( h2.size() == 0 ) { int r = lrand48() % 100; std::cout << "+" << r << '\t'; h2.push( r ); } else if ( lrand48() & 1 ) { std::cout << "-" << '\t'; h2.pop(); } else { int r = lrand48() % 100; std::cout << "+" << r << '\t'; h2.push( r ); } h2.print(); } return 0; }