algorithm
azi.vbQ1)
Show, by applying the limit test, that each of the following is true.
a) The functions f(n)= n(n-1)/2 and g(n)= n^2 grow asymptotically at equal rate.
b) The functions f(n)=log n grow asymptotically at slower rate than g(n)=n.
Q2)
Show that log (n!) = Θ (nlog n);
Q3)
Design an algorithm that uses comparisons to select the largest and the
second largest of n elements. Find the time complexity of your algroithm
(expressed using the big-O notation).
Q4)
Given an a binary array or list of n elements, where each element is either
a 0 or 1, we would like to arrange the elements so that all of those that
are equal to 0's appear first followed by all the elements that are equal
to 1's.
a) Write an algroithm or a function that uses comparisons to arrange the
elements as given above. Do not use any extra arrays in your algorithm.
b) Find the time, T(n), needed by your algorithm in the worst-case and
then express it using the big-O notation.
c) Find the time, T(n), needed by your algorithm in the best-case and
then express it using the big-Ω notation.
d) Find the time, T(n), needed by your algorithm in the average-case
and express it using the big-Θ notation.
- 12 years ago
- 7
Answer(1)
Purchase the answer to view it
NOT RATED
Bids(0)
other Questions(10)
- What is the volume of a rectangular prism with the height of 9 ft, length of 6 ft, and the...
- Your piggy bank contains 19.75 in dimes and quarters.there are 100 coins in all.how many dimes are there?
- y=4x-9 y=x-3
- they pay $18 for 12 dozen buttons.How much do 50 dozen buttons cost?
- On a coordinate plane,graph the points(1,-2)and(-1,-4).Draw a line through the points. b. make a table of these ordered pairs and three...
- Explain how the productive capacity of the industries of the United States aided the Allies' war effort.
- The gene material carries out what two functions
- whats another name for subatomic particles?
- An energy-saving light bulb wastes 5 j of energy for every 20 j of energy it radiates as light, how...
- write the following as a whole number and its corresponding indice