Question: Consider the C function below called wasteTime(). Your goal is to determine how much time wastTime() wastes. The stared (*) lines below are to be
Consider the C function below called wasteTime(). Your goal is to determine how much time wastTime() wastes. The stared (*) lines below are to be considered basic operations, which do nothing but waste a multiple of some unspecified time unit. Determine the total amount T(n) of time wasted on the input n. Find the asymptotic runtime of this algorithm, i.e. T(n) = ?(some simple function of n). void wasteTime(int n){ int i, j, k; * waste 2 units of time; for(i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
