Assignment # 1: Analyze (I.e., Compute) The Running Time T (N) of The Following Nested Loops

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CS 250: Data Structures & Algorithms

Instructor: Dr. Muhammad Shahzad


Class: BEE-7AB

Assignment # 1
(Due date: 28.11.2016)

Analyze (i.e., compute) the running time T(n) of the following nested loops:
for i = 1 to n {
...
for j = 1 to 2*i {
...
k = j;
while (k >= 0) {
...
k = k - 1;

// assume that n is input size

}
}
}

Additionally, please also write the combined Big-O of the above code.

You might also like