#include #include using namespace std; #include "Beap.h" using namespace Data_structures; int main() { Beap beap; srand( time(0) ); cout << beap << endl; for ( int i = 1; i <= 100; ++i ) { int n = rand() % 100; cout << "Inserting " << n << endl; beap.push( n ); cout << "Inserted " << n << endl; cout << "Size " << beap.size() << endl; cout << "Height " << beap.height() << endl; cout << "Top " << beap.top() << endl; cout << "Back " << beap.back() << endl; } cout << beap << endl; cout << "Find:" << endl; for ( int i = 0; i < 100; ++i ) { if ( beap.find( i ) ) { cout << i << " "; } } cout << endl << endl; cout << "Count:" << endl; int c = 0; for ( int i = 0; i < 100; ++i ) { c += beap.count( i ); if ( beap.count( i ) ) { cout << i << "(" << beap.count( i ) << ") "; } } cout << "Items counted: " << c << endl << endl; cout << endl << endl; for ( int i = 0; i < 50; ++i ) { cout << beap.top() << "\t(" << beap.capacity() << ")" << endl; beap.pop(); // cout << beap << endl; } cout << "Find:" << endl; for ( int i = 0; i < 100; ++i ) { if ( beap.find( i ) ) { cout << i << " "; } } cout << endl << endl; cout << "Count:" << endl; c = 0; for ( int i = 0; i < 100; ++i ) { c += beap.count( i ); if ( beap.count( i ) ) { cout << i << "(" << beap.count( i ) << ") "; } } cout << "Items counted: " << c << endl << endl; cout << endl << endl; for ( int i = 0; i < 50; ++i ) { cout << beap.top() << "\t(" << beap.capacity() << ")" << endl; beap.pop(); // cout << beap << endl; } return 0; }