Question
1. (a) Express the function f(n) = 2n^3 + n^2 10n + 3 in terms of -notation. 2. (a) Given an array A of n
1. (a) Express the function f(n) = 2n^3 + n^2 10n + 3 in terms of -notation.
2. (a) Given an array A of n numbers, write down the binary search algorithm BinSearch (A, n, key) to determine whether there is a number in A that is equal to key. Assume that array A is sorted in non-decreasing order.
(b) Let T(n) be the runtime of the above binary search algorithm. Write down a recurrence relation for T(n).
3. Write down the merge-sort algorithm to sort n numbers in an array A in ascending order.
(a) First provide a description of the ideas used in the algorithm.
(b) Write down the pseudocode of the algorithm.
(c) Write a recurrence relation for the runtime, T(n), of this algorithm.
Please Show all Work!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started