How can i compare the efficiency of two algorithms? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i compare the efficiency of two algorithms?

6th Feb 2017, 8:12 PM
Shahiryar Arif
Shahiryar Arif - avatar
5 Answers
+ 7
You can also use the amount of space it takes up in bits...
6th Feb 2017, 8:47 PM
J.G.
J.G. - avatar
+ 2
I believe you could do a time trial for each of them. Basically start a timer as they run to see how long it takes to go through the code and end it when it reaches the end. Print both times to see which was quicker.
6th Feb 2017, 8:15 PM
Gage Hembach
Gage Hembach - avatar
+ 2
by measuring the difference in time needed to execute them.
6th Feb 2017, 8:15 PM
seamiki
seamiki - avatar
+ 1
write a timer that starts when the algorithms starts and stops when it is done
6th Feb 2017, 11:17 PM
LordHill
LordHill - avatar
0
3rd Sep 2021, 6:34 AM
20T1020 Diksha_ Borkar
20T1020 Diksha_ Borkar - avatar