#include "PriorityQueue.h" #include using namespace std; const int N = 29; const int M = 97; int main( ) { PriorityQueue q; int minVal1, minVal2; int i, j; for( i = N; i != 0; i = ( i + N ) % M ) q.insert( i ); cout << "Completed first round of insertions" << endl; for( j = 1; !q.isEmpty( ); j += 2 ) { minVal1 = q.findMin( ); q.removeMin( ); q.removeMin( minVal2 ); if( minVal1 != j || minVal2 != j+1 ) cout << "OOPS!!!!!" << minVal1 << " " << minVal2 << " " << j << " " << (j+1) << endl; } cout << "Completed first round of deletions" << endl; for( i = N; i != 0; i = ( i + N ) % M ) q.insert( i ); cout << "Completed second round of insertions" << endl; for( i = 0; i < M - 5; i += 2 ) { q.removeMin( ); cout << q.findMin( ) << endl; } q.makeEmpty( ); if( !q.isEmpty( ) ) cout << "q is unexpectedly not empty" << endl; cout << "Emptying q2" << endl; PriorityQueue q2 = q; while( !q2.isEmpty( ) ) { int y; q2.removeMin( y ); cout << y << endl; } cout << "Program end reached" << endl; return 0; }