+ 3

How to find faster algorithms to solve a problem?

Hi guys. How can I find faster algorithms to solve a problem in python? (or any programming languages) I'm new and I can't understand pseudo-polynomial time . So I'm looking for a good idea that lead me to faster ways.

14th Oct 2018, 7:09 AM
Mehran sanea
Mehran sanea - avatar
1 Answer
+ 7
It usually boils down to cracking the code to use as few computations as possible. Especially, pre-cleaning the data used in algorithms so that they won't execute empty loops (not nearing to the result). While on loops - they are kind of slow. Really slow. So fewer of them you have, the better. For example, when you think of finding primes, you can try looking for divisors from 1 to n, but some of those checkups aren't necessary and you can avoid them (sieving them away before the checkup). That saves a lot of time, which is crucial for longer runs. Read more on algorithms time complexity here: https://www.sololearn.com/learn/6362/?ref=app
14th Oct 2018, 11:37 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar