Algorithmic complexity of naive code for processing all consecutive subsequences of a list: n^2 or n^3?

前端 未结 9 1109
傲寒
傲寒 2020-12-25 11:41

I\'m studying for a test and found this question:

I can\'t really determine the complexity, I figured it\'s either O(n2) or O(n3) and I\'m lea

9条回答
  •  眼角桃花
    2020-12-25 12:16

    You can proceed methodically, using Sigma Notation, to obtain the order of growth complexity:

    enter image description here

提交回复
热议问题