How to find time efficiency? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find time efficiency?

Though our code has give us a solution...there is a factor(time efficiency) has diffentiate our code with others..How can we obtain a code with good time efficiency

26th Jan 2018, 7:32 AM
Kiruthika Ns
Kiruthika Ns - avatar
3 Answers
+ 1
Can you say for Python
26th Jan 2018, 7:40 AM
Kiruthika Ns
Kiruthika Ns - avatar
+ 1
import time start = time.process_time() #code_here end = time.process_time() print(end-start, "seconds")
26th Jan 2018, 7:45 AM
Vlad Serbu
Vlad Serbu - avatar
0
If you're asking how to write code with good time efficiency you do it by writing efficient code using efficient algorithms. If you're asking how to time your code, that depends on the language. Here's how to do it in C++: http://www.cplusplus.com/reference/chrono/high_resolution_clock/now/
26th Jan 2018, 7:39 AM
Vlad Serbu
Vlad Serbu - avatar