Analyze the time complexity of the code segment and find their Big-O. int myfunction3(int n) { if (n < 10) { printf("Hello!"); return n+3; } else { return myfunction3(n-1) + 1; } }
Analyze the time complexity of the code segment and find their Big-O. int myfunction3(int n) { if (n < 10) { printf("Hello!"); return n+3; } else { return myfunction3(n-1) + 1; } }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Analyze the time complexity of the code segment and find their Big-O.
int myfunction3(int n) {
if (n < 10) {
printf("Hello!");
return n+3;
} else {
return myfunction3(n-1) + 1;
}
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps