for i 0 i lt n i sequence of statementshere


for (i = 0; i < n; i + +) {

sequence of statements

}

Here, the loop executes n times. Thus, the sequence of statements also executes n times. Since we suppose the time complexity of the statements are O(1), the overall time for the loop is n * O(1), that is O(n). Here, the number of statements does not matter as it will enhance the running time by a constant factor and the overall complexity will be same O(n).

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: for i 0 i lt n i sequence of statementshere
Reference No:- TGS0411913

Expected delivery within 24 Hours