Ask Question
12 July, 12:36

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; }}

+4
Answers (1)
  1. 12 July, 12:44
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers