Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given runtime of three different algorithms as below: T 1 ( N ) = N 2 l g N , T 2 ( N )

Given runtime of three different algorithms as below:
T1(N)=N2lgN,T2(N)=N3 and T3(N)=(1.2)N
Construct a table by varying N from N=10 to 200 and find out which algorithm is worst and which is best. Give proper reasoning for that.
2. Using the definition of big-O, big-omega () and big-theta () determine the best and worst algorithms in the following is given:
T1(N)=(N2),T2(N)=O(N2) and T3(N)=(N2)
Give proper justification to your answer.
3. Given a recursive function as below, you need to show all the steps (do not answer this question by running the computer program in a machine, but need to show the steps by hand calculation).
int mystery(int n)
{
if )(10
{
return n;
}
else
{
int a=n10
int b=n%10;
return mystery (a+b);
}
}
Determine the value of mystery(648)
4. Write a C++ program that would use a recursive function IsPalindrome(S, first, last)(please see the pseudocode for the algorithm) to check is a string S is Palindrome or not.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions

Question

Describe the major steps in developing rule-based ES.

Answered: 1 week ago

Question

manageremployee relationship deteriorating over time;

Answered: 1 week ago