educative.io

Time complexity of Brute Force Approach Not Answered Properly In Other Two Posts

In the other two posts regarding this topic:

The reason for the The Complexity being O (N * K) has not been answered correctly or explained clearly.
Please provide a proper reasoning for the Time Complexity.


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/6658855733821440

Hi, considering we have an array of n element. For every nth element we need to compute the average of next k elements. This means we have to iterate k elements n times. This makes it O(N*K).