# 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

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

What are the big-O general times of the subjoined methods, with deference to the bigness of the set-in-order? What are the big-O general times of the subjoined methods, with deference to the bigness of the set-in-order? useless m6(int [] A){ restraint (int i = 0;i

## Expert Response

Let the bigness of the set-in-order be n and the Time Complexity of m1(A) be T1

h) SInce the treasure of is incremented in powers of 2 ,i.e., 1,2 ,4,8,16….to diffusiveness of Set-in-order

Time Complexity = O(log2n)

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

Time Complexity = O(log2n)

g) There is a restraint loop of bigness 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)