Ask Question
12 April, 15:34

uppose that we have a function with a constant amount of work done in initialization, a call to a log-linearsorting algorithm, and a loop that iterates n times, doing a linear amount of work in each iteration. What is the running time of the algorithm

+3
Answers (1)
  1. 12 April, 18:02
    0
    The running time is quadratic (O (n²))

    Step-by-step explanation:

    For the set up, we have a constant running time of C. The, a log-linearsorting is called, thus, its execution time, denoted by T (n), is O (n*log (n)). Then, we call n times a linear iteration, with a running time of an+b, for certain constants a and b, thus, the running time of the algorithm is

    C + T (n) + n * (a*n+b) = an²+bn + T + C

    Since T (n) is O (n*log (n)) and n² is asymptotically bigger than n*log (n), then the running time of the algorith is quadratic, therefore, it is O (n²).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “uppose that we have a function with a constant amount of work done in initialization, a call to a log-linearsorting algorithm, and a loop ...” in 📘 Mathematics 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