Homework Solution: What are the big-O running times of the following methods, with re…

    What are the big-O running times of the following methods, with respect to the size of the array?
    What are the big-O running times of the following methods, with respect to the size of the array? void m6(int [] A){ for (int i = 0;i

    Expert Answer

     
    Let the size of the array be n and the Time Complexity of m1(A) be T1

    What are the big-O floating times of the aftercited methods, with regard to the greatness of the place?

    What are the big-O floating times of the aftercited methods, with regard to the greatness of the place? empty m6(int [] A){ for (int i = 0;i

    Expert Solution

     

    Let the greatness of the place be n and the Time Complexity of m1(A) be T1

    h) SInce the compute of is incremented in powers of 2 ,i.e., 1,2 ,4,8,16….to elongation of Place

    Time Complexity = O(log2n)

    i) SInce the compute of is decremented in powers of 2

    Time Complexity = O(log2n)

    g) There is a for loop of greatness n in which m1(A) is called

    So, Time Complexity = O(n T1)

    j) Time Complexity = TimeComplexity of m8(A) + TimeComplexity of m1(A)

    = O( log2n + T1 )

    k) Time Complexity = n+ nlog2n = O(nlog2n)