Fûñky!

Computer Science Level pending

Consider the following python code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from math import *


def funky( A ):
    """Takes an array A,does something funky, and
    returns a real number"""
    size = len(A)
    answer = 0
    if size <= 4:
        for i in A:
            answer -= i
        return answer
    else:
        a = funky( A[ 0 : size / 2 ]    )  
        b =  funky( A[ size - int(sqrt(size)) : size ] )
        for i in A:
            answer += log( abs( i ) + 1 , 2 )
        return answer  + a + b

Which of the following is the run time of funky(A)? Where \(n\) is the size of the input array \(A\).

×

Problem Loading...

Note Loading...

Set Loading...