There are 2 buildings and on each’s window, a flower pot is kept. Ravi’s mother tells him to multiply each cell/window to the other and store in a matrix ? What would be time complexity if he writes a code to do so ?



There are 2 buildings and on each’s window, a flower pot is kept. Ravi’s mother tells him to multiply each cell/window to the other and store in a matrix ? What would be time complexity if he writes a code to do so ?

A. Omega(n)

B. Omega(n2)

C. Theta (n)

D. Theta (n2)

Answer : D. Theta(n2)


Explanation:

  • The multiplication involved will use two for loops and hence the complexity will be Theta(n2)

Related Searches to There are 2 buildings and on each’s window, a flower pot is kept. Ravi’s mother tells him to multiply each cell/window to the other and store in a matrix ? What would be time complexity if he writes a code to do so ?