Worst case running time Describe the worst case running time of the following code in “big-Oh" notation in terms of the variable n. You should give the tightest bound , possible. (a) sum = 0; for( i = 1; i < n; i++ ) for( j = 1; j < i * i; j++ ) if( j % i == 0 ) for( k = 0; k < j; k++ ) sum++;
Worst case running time Describe the worst case running time of the following code in “big-Oh" notation in terms of the variable n. You should give the tightest bound , possible. (a) sum = 0; for( i = 1; i < n; i++ ) for( j = 1; j < i * i; j++ ) if( j % i == 0 ) for( k = 0; k < j; k++ ) sum++;
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
Worst case running time Describe the worst case running time of the following code in “big-Oh" notation in terms of the variable n. You should give the tightest bound , possible.
(a) sum = 0;
for( i = 1; i < n; i++ )
for( j = 1; j < i * i; j++ )
if( j % i == 0 )
for( k = 0; k < j; k++ )
sum++;
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps