0% found this document useful (0 votes)
5 views1 page

Cs502 Assignment

Uploaded by

iqbalquid83
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Cs502 Assignment

Uploaded by

iqbalquid83
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Question No.

1 Solution

Step 1:int n = arr.size();


O(1)
Step 2: for (int i = 0; i < n; ++i) {
O(n)
Step 3: std::cout << arr[i] << std::endl;
O(n)
}
Step 4: for (int j = 0; j < n; ++j) { O(
n)
3

Step 5: for (int k = 0; k < n; ++k) { O¿)


Step 6: for (int l = 0; l < n; ++l) { O¿
)
Step 7: std::cout << arr[j] * arr[k] * arr[l] << std::end O(n3 )
}
}
}
The overall complexity of all code is O(n3 ).

You might also like