Timer is important for measuring speed-ups, or elapsed time for comparing different algorithms. We used to import <ctime> and measure the elapsed time with the following code:

However, the clock() function measures the CPU time, not actual time elapsed (which may be much greater), according to this StackOverFlow thread. Hence, here I share my code…