Question
Hello, I would like to get help with the following algorithms and their respective analysis of runtime along with their recurrence equations, thanks in advance.
Hello, I would like to get help with the following algorithms and their respective analysis of runtime along with their recurrence equations, thanks in advance.
1. Analyze each of the following algorithms by providing a tight big-Oh bound on the run time with respect to the value n. Create a recurrence equation.
a.
void padawan(int n)
{
if( n <= 10 )
time++;
else
{
for(int i=0; i time++; padawan(n/3); padawan(n/3); padawan(n/3); } } b. void nerfHerder(int n) { if( n <= 15 ) time++; else { for(int i=0; i time++; nerfHerder(n-1); } } c. void squire(int n) { if( n <= 12 ) time++; else { squire(n/2); squire(n/2); for(int i=0; i for(int j=i; j time++; squire(n/2); squire(n/2); squire(n/2); squire(n/2); squire(n/2); squire(n/2); } }
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