Browsed by
Category: Algorithms

[Python,Algorithms] Fast Modular exponentiation script

[Python,Algorithms] Fast Modular exponentiation script

If we want to know the last ten digits of number an – we have to evaluate expression an mod 1010. Using brute force approach, we have to do O(n) ( If you don’t understand big „O” notation, visit: Big O notation – it’s VERY important) multiplications and modulo divisions. When n is greater than 109, it will take a lot of time. Fortunately, we can use more „mathematical” approach, which has O(log n) complexity.

[Algorithms] List of online judges/algorithmical contests

[Algorithms] List of online judges/algorithmical contests

Here is a list of websites, which are sets of algorithmical tasks or online contests: http://www.topcoder.com http://www.spoj.pl http://icpcres.ecs.baylor.edu/onlinejudge/ http://acm.timus.ru http://acm.mipt.ru/judge http://www.uwp.edu/sws/usaco/ http://acm.sgu.ru/ http://projecteuler.net/