0 votes 0 votes Algorithms time-complexity algorithms asymptotic-notation programming-in-c test-series + – Parshu gate asked Sep 17, 2017 retagged Jul 13, 2022 by makhdoom ghaya Parshu gate 621 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes 1st for loop run 1 time 2nd for loop(inner loop )run 2n time 3rd for loop only run 1st time for n time and for next 2n- 1 time it only check condition So complexity is O(n) sachin! answered Sep 17, 2017 sachin! comment Share Follow See all 2 Comments See all 2 2 Comments reply Parshu gate commented Sep 18, 2017 reply Follow Share Why 1st for loop run only 1 time? 0 votes 0 votes sachin! commented Sep 18, 2017 reply Follow Share as inner loop increment value of i=2*n 0 votes 0 votes Please log in or register to add a comment.