This is a Data Structures question Discuss the time complexi

This is a Data Structures question...

Discuss the time complexity of the following algorithm for (i=5; i

Solution

The time complexity of the Algorithm displayed is O(N^2). Big O notation is the upper bound of the function time complexity. The time complexity of a first For Loop is O(N). Since we have nested For-Loop is also O(N). On combining both the loops we have O(N^2).

Hope Answer helps you.

This is a Data Structures question... Discuss the time complexity of the following algorithm for (i=5; iSolutionThe time complexity of the Algorithm displayed i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site