Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
map.c
Package: leda.tar.gz [view]
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 1k
Category:
Mathimatics-Numerical algorithms
Development Platform:
MultiPlatform
- #include <LEDA/map.h>
- #include <LEDA/h_array.h>
- #include <LEDA/d_array.h>
- #include <LEDA/dph_array.h>
- main()
- {
- int N0[10000];
- int i;
- for(i=0; i<1000; i++) N0[i] = 0;
- map<int,int> M(0);
- h_array<int,int> N1(0);
- d_array<int,int> N2(0);
- dph_array<int,int> N3(0);
- int n = read_int("n = ");
- int* A = new int[n];
- rand_int.set_seed(1234*n);
- for(i=0; i<n; i++) A[i] = rand_int(1,9999);
- float T = used_time();
- for(i=0; i<n; i++) N0[A[i]]++;
- cout << string("c++ array: %.2f sec",used_time(T)) << endl;
- T = used_time();
- for(i=0; i<n; i++) M[A[i]]++;
- cout << string("map: %.2f sec",used_time(T)) << endl;
- T = used_time();
- for(i=0; i<n; i++) N1[A[i]]++;
- cout << string("h_array: %.2f sec",used_time(T)) << endl;
- for(i=0; i<n; i++) N2[A[i]]++;
- cout << string("d_array: %.2f sec",used_time(T)) << endl;
- for(i=0; i<n; i++) N3[A[i]]++;
- cout << string("dph_array: %.2f sec",used_time(T)) << endl;
- for(i=1; i<1000; i++)
- if (M[i] != N0[i] || N1[i] != N0[i] || N2[i] != N0[i] || N3[i] != N0[i])
- cout << "ERROR" << endl;
- return 0;
- }