Algorithm A executes an O (log n )-time computation for each entry of an n -element array.

1. Algorithm executes an O(log n)-time computation for each entry of an n-element array. What is the worst-case running time of Algorithm A?

2. Given an n-element array X, Algorithm B chooses log elements in at random and executes an O(n)-time calculation for each. What is the worst-case running time of Algorithm B?

3. Given an n-element array of integers, Algorithm C executes an O(n)- time computation for each even number in X, and an O(logn)-time computation for each odd number in X. What are the best-case and worst-case running times of Algorithm C?

Expert's Answer

Need Urgent Academic Assistance?

Get Professional Help at Low Prices!

*
*
*


*

TOP
Order Notification

[variable_1] from [variable_2] has just ordered [variable_3] Assignment [amount] minutes ago.