Home »
MCQs »
Algorithms MCQs
Which of the following statements is true about Kadane's Algorithm?
52. Which of the following statements is true about Kadane's Algorithm?
- It finds the maximum sum of any subarray in O(N^2) time.
- It requires additional space proportional to the size of the array.
- It finds the maximum sum of a contiguous subarray in O(N) time.
- It cannot handle arrays with all negative numbers.
Answer
The correct answer is: C) It finds the maximum sum of a contiguous subarray in O(N) time.
Explanation
Kadane's Algorithm efficiently finds the maximum sum of a contiguous subarray with a linear time complexity, O(N).