Programmaticaly finding the Landau notation (Big O or Theta notation) of an algorithm?
Posted
by
Julien L
on Programmers
See other posts from Programmers
or by Julien L
Published on 2012-09-07T02:33:22Z
Indexed on
2012/09/07
3:48 UTC
Read the original article
Hit count: 614
I'm used to search for the Landau (Big O, Theta...) notation of my algorithms by hand to make sure they are as optimized as they can be, but when the functions are getting really big and complex, it's taking way too much time to do it by hand. it's also prone to human errors.
I spent some time on Codility (coding/algo exercises), and noticed they will give you the Landau notation for your submitted solution (both in Time and Memory usage).
I was wondering how they do that... How would you do it?
Is there another way besides Lexical Analysis or parsing of the code?
PS: This question concerns mainly PHP and or JavaScript, but I'm opened to any language and theory.
© Programmers or respective owner