Back to course home
0% completed
Vote For New Content
Isn't the time complexity just O(n)? since it will always be the case that n >= ...
Alfonso Vieyra
Sep 6, 2022
Isn't the time complexity just O(n)? since it will always be the case that n >= k?
0
0
Comments
Comments
Design Gurus3 years ago
That's right. (you meant N >= M?)
If M is always less than or equal to 'N' (which will be in this algorithm):
O(N+M) => O(N+N) => O(2N) => O(N)
On this page