如何计算大Theta

我正在努力了解Big Theta以及如何为以下功能进行计算。

def func(l, s, d):
    """
    Args:
        l (:obj:`list`): a list of integers.
        s (:obj:`list`): a list of integers behaving as a stack.
        d (:obj:`dict`): a dictionary with integer values.
    """

    r = 0
    while len(s) > 0:
        s_item = s.pop()
        for i in l:
            for k,v in d.items():
                r += v + i * s_item

    return r


from copy import deepcopy

def func1(l):
    """
    Args:
        l (:obj:`list`): a list of integers.
    """

    r = 0

    for i in l:
        l2 = deepcopy(l)
        while len(l2) > 0:
            r += i**2
            l2 = l2[:len(l2)//2]

    return r

为这些功能找到较大的Theta,我需要遵循哪些步骤? 干杯

评论