...
Question 956 – Nielit Scientist-B IT 4-12-2016
December 3, 2023
Question 1185 – Nielit Scientist-B CS 22-07-2017
December 3, 2023
Question 956 – Nielit Scientist-B IT 4-12-2016
December 3, 2023
Question 1185 – Nielit Scientist-B CS 22-07-2017
December 3, 2023

Question 1186 – Nielit Scientist-B CS 22-07-2017

Kadane algorithm is used to find

Correct Answer: B

Question 39 Explanation: 
Kadane algorithm is used to find the maximum sum subarray in an array. It runs in O(n) time complexity
Implementation in python:
def max_subarray(A):
max_ending_here = max_so_far = A[0]
for x in A[1:]:
max_ending_here = max(x, max_ending_here + x)
max_so_far = max(max_so_far, max_ending_here)
return max_so_far
A
Maximum sum subsequence in an array
B
Maximum sum subarray in an array
C
Maximum product subsequence in an array
D
Maximum product subarray in an array
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!