+ 3

What takes a code less time to completely execute?

I often wonder how to make my algorithms take less time while execution.

2nd Jul 2018, 6:42 PM
Abhishek Tandon
Abhishek Tandon - avatar
5 Réponses
3rd Jul 2018, 9:36 AM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 2
Saurabh Tiwari Thanks 😀
3rd Jul 2018, 9:54 AM
Abhishek Tandon
Abhishek Tandon - avatar
0
- Decrease number of steps required to finish - Remove/replace time consuming tasks like calculating cos
2nd Jul 2018, 8:01 PM
TurtleShell
TurtleShell - avatar
0
Additionally to the suggestions from TurtleShell, using compilation time comes to my mind. For example in C++, the compiler is able to evaluate "const" and "constexpr" expressions at compile time, meaning it isn't necessary at runtime anymore, effectively decreasing the runtime of your program. For C++, look up "Template Meta Programming" for more information on this topic.
2nd Jul 2018, 10:56 PM
Shadow
Shadow - avatar
0
void writing lot of if else statement
3rd Jul 2018, 1:12 PM
Driss Aharik
Driss Aharik - avatar