KonkurStudy
همه کارت‌ها

Loop Running Time as a Sum of Per-Iteration Work

The cost of a loop is the SUM of the work each iteration does, not (iterations) x (max cost). When the body costs a constant, the sum collapses to (count) x O(1); when the body cost varies with i, evaluate the series. Split a loop with several statements into separate sums and add them.

کارت مفهوم کنکور ارشد علوم کامپیوتر