Question: Given the code below, answer the following the questions: 1 for i in 1 . . N loop 2 for j in 1 . .

Given the code below, answer the following the questions:
1 for i in 1..N loop
2 for j in 1..i loop
3 for k in i..j loop
4, Sum := Sum +1 ;
5 end loop;
6 end loop;
7 end loop;
8 for p in 1..N*N loop
9 for q in 1..p loop
10 Sum := Sum -1;
11 end loop;
12 end loop;
(a) How many times is statement 4 executed? (use big Theta notation)
(b) How many times is statement 10 executed? (use big theta notation)
(c) what is the run time of this piece of code?
 Given the code below, answer the following the questions: 1 for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!