- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
seq_test.c
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- #include <LEDA/_sortseq.h>
- #include <LEDA/impl/skiplist.h>
- #include <LEDA/impl/ab_tree.h>
- #include <LEDA/impl/bin_tree.h>
- void seq_test(sortseq<int,int>& D, int N, int* A, char* name)
- { int i;
- float T0 = used_time();
- float T = T0;
- cout << string("%-10s",name);
- cout.flush();
- for(i=0; i<N; i++) D.insert(A[i],0);
- cout << string("%10.2f",used_time(T));
- cout.flush();
- for(i=0; i<N; i++) D.lookup(A[i]);
- cout << string("%10.2f",used_time(T));
- cout.flush();
- for(i=0; i<N; i++) D.del(A[i]);
- cout << string("%10.2f",used_time(T));
- cout << string("%10.2f",used_time(T0));
- newline;
- }
- main()
- {
- sortseq<int,int> RS_SEQ;
- _sortseq<int,int,skiplist> SKIP_SEQ;
- _sortseq<int,int,ab_tree> AB_SEQ;
- _sortseq<int,int,bin_tree> BIN_SEQ;
- int N = read_int("# keys = ");
- int* RAND = new int[N];
- for(int i=0; i<N; i++) RAND[i] = rand_int(0,1000000);
- newline;
- cout << " insert lookup delete total";
- newline;
- newline;
- seq_test(RS_SEQ,N,RAND,"rs_tree");
- seq_test(SKIP_SEQ,N,RAND,"skiplist");
- seq_test(AB_SEQ,N,RAND,"ab_tree");
- seq_test(BIN_SEQ,N,RAND,"bin_tree");
- return 0;
- }