I am trying to figure out how many primitive operations there are in this code and how many primitive operations are being executed over the runtime of this algorithm:
What have I tried to get the answer so far
I attempted to write the code out onto a piece of paper and go through it line by line. I separated each line into a cost and times ran section in hopes of figuring it out. I ended with T(O) = 2n +6i which seems incorrect.
Here is a snippet of my work:
I would greatly appreciate if someone could help me break this problem into concrete steps so I can better understand this topic as a whole.
question from:
https://stackoverflow.com/questions/65866356/need-help-figuring-out-time-complexity-of-this-pseudocode 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…