📄 expir.cpp
字号:
#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 << "数据序列长度为:" << 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程序运行时间 " << end - start <<endl;
}
cout <<endl;;
for( i = 500; i <= 5000; i = i + 500 )
{
DWORD start = GetTickCount();
cout << "数据序列长度为:" << 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程序运行时间 " << end - start <<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -