Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Program to find Big-O notation?

Name: Anonymous 2013-06-17 23:43

Is there a program or a library that I could use to find the O() of an algorithm? For example,

def O_1(n):
    return n

def O_n(n):
    s = 0
    for i in range(0, n):
        s = s + i
    return s
   
def O_n2(n):
    m = 1
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            m = m * i * j
    return m
   
print("O(O_1()) = "  + O(O_1) ) # O(O_1()) = O(1)
print("O(O_n()) = "  + O(O_n) ) # O(O_n()) = O(n)
print("O(O_n2()) = " + O(O_n2) ) # O(O_n2()) = O(n^2)


Is there a library that would work as O(f) should?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List