-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBinomialQueue.cpp
More file actions
34 lines (27 loc) · 839 Bytes
/
TestBinomialQueue.cpp
File metadata and controls
34 lines (27 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "BinomialQueue.h"
#include <iostream.h>
int main( )
{
int numItems = 10000;
BinomialQueue<int> h;
BinomialQueue<int> h1;
BinomialQueue<int> h2;
int i = 37;
for( i = 37; i != 0; i = ( i + 37 ) % numItems )
if( i % 2 == 0 )
h1.insert( i );
else
h.insert( i );
h.merge( h1 );
h2 = h;
for( i = 1; i < numItems; i++ )
{
int x;
h2.deleteMin( x );
if( x != i )
cout << "Oops! " << i << endl;
}
if( !h1.isEmpty( ) )
cout << "Oops! h1 should have been empty!" << endl;
return 0;
}