?? expir.cpp
字號(hào):
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include "MinHeap.h"
#include "MinLeftlistTree.h"
#include <ctime>
#include <cmath>
#include <windows.h>
int main()
{
int *num;
for( int i = 500; i <= 5000; i = i + 500 )
{
cout << "數(shù)據(jù)序列長(zhǎng)度為:" << i;
num = new int [i];
MinHeap a(i);
srand( time(0) );
for( int j = 0; j < i; j++ )
{
int randNumber = rand() % i;
num[j] = randNumber;
}
DWORD start = GetTickCount();
for( j = 0; j < 500000; j++ )
{
if( j%2 == 1 )
{
Element choose;
choose.key = rand() % i;
a.Insert( choose );
}
else
{
Element del;
a.Delete( del );
}
}
DWORD end = GetTickCount();
cout << " MinHeap程序運(yùn)行時(shí)間 " << end - start <<endl;
}
cout <<endl;;
for( i = 500; i <= 5000; i = i + 500 )
{
DWORD start = GetTickCount();
cout << "數(shù)據(jù)序列長(zhǎng)度為:" << i;
num = new int [i];
MinLeftlistTree b;
srand( time(0) );
for( int j = 0; j < i; j++ )
{
int randNumber = rand() % i;
num[j] = randNumber;
}
for( j = 0; j < 500000; j++ )
{
if( j%2 == 1 )
{
element choose;
choose.key = rand() % i;
b.Insert( choose );
}
else
{
element del;
b.Delete( del );
}
}
DWORD end = GetTickCount();
cout << " MinLeftlistTree程序運(yùn)行時(shí)間 " << end - start <<endl;
}
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -