big o - Time complexity of the algorithm by counting the comparisons and we need to give a big o estimate -


time complexity of algorithm counting comparisons , need give big o estimate how can do?

enter image description here

 := 1 m                // loop 1     j:= 1 n             // loop 2         cij := 0         q := 1 k        // loop 3             cij := cij + aiqbqj return c 

note within loop 2, there k + 1 assignments, while j loops 1 n, there in total n * (k + 1) assignments.

adding on top of that, while i loops 1 m there in total m * n * (k + 1) assignments.

so time complexity of code o(m * n * (k + 1)) = o(mnk).


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -