Answer on Question #62637 – Math – Algorithms | Quantitative Methods
Question
Give the most compact theta notation for the number of times the statement is executed in the following pseudo-code:
for to {
for to {
}
}
Solution
The inner loop with index performs the statement 's n times.
The loop with index performs the inner loop times.
Thus, both loops perform the statement 's 's n times.
Here is a quadratic function, drop the factor 3 and the low-order term .
So the most compact theta notation for the number of times when the statement
's is executed will be .
Answer: .
www.AssignmentExpert.com
Comments