Ask Question
15 March, 11:01

Consider the following pseudocode. How much time does the code take to execute? Express all answers in terms of the input variable n, using Big-Oh O () notation. void george (int n) {int m = n; while (m > 1) { for (int i = 1; i < m; i++) int S = 1; m = m/2; }}

+2
Answers (1)
  1. 15 March, 12:02
    0
    Time the code takes to execute is O (n²)

    Explanation:

    The code forms an arithmetic series using it two loops.

    n + (n-1) + (n-2) + ... + 2+1

    =n (n+1) / 2

    =O (n²)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Consider the following pseudocode. How much time does the code take to execute? Express all answers in terms of the input variable n, using ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers