我想知道如何计算 C++ 程序中 O_notation 的运行时间?有什么代码吗?
我必须使用此代码来显示运行时间
clock_t start, end;
start = clock();
//CODES GOES HERE
end = clock();
std::cout << end - start << "\n";
std::cout << (double) (end-start) / CLOCKS_PER_SEC;
但我想在 O_notation 代码中计算它,以便在 2 个程序 min-heap 和 prim 的数组算法中实现它。