Is There a Tool to Automatically Calculate Big-O Complexity for a Function [Duplicate]
While Studying Algorithms and Data Structures I Manually Evaluate Bigo Complexity for My Script. Is There a Way, Let Say a Button in Any Python Ide or a...
While studying algorithms and data structures I manually evaluate BigO complexity for my script. Is there a way, let say a button in any Python IDE or a package, to calculate BigO for any given function or a program?
UPDATE:
Let's say I have
def print_first_element(a):
print a[0]
why I can't write the analyzer which will say me ok you access the array (list) by index and its O(1), or
def print_all_element_of_list(a):
for i in a:
print i
ok you have full scan so the complexity is O(n)
and so forth
Unfortunately, infeasible. See Halting Problem.
It's not possible in general. Here's one python program that can compute the complexity for some program: