I have a task, to compare time for search a data in 2 different method data search (sequential and binary search), there are program for compare two different program ?
> compare time for search a data in 2 different method data search (sequential and binary search),
> there are program for compare two different program ?
Simpler (and quite a lot more accurate) to compare the time taken for two different functions (sequential and binary search) within the same program.
int start_s=clock();
// the code you wish to time goes here
int stop_s=clock();
cout << "time: " << (stop_s-start_s)/double(CLOCKS_PER_SEC)*1000 << endl;
I've Already use that to my code, but why the ouput always 0s ??