Consider The Following Naive Method To Find The Maximum #1985
Consider the following naive method to find the maximum sub-array sum:</p> <pre><code class="language-c"> #include<stdio.h> int main() { int arr[1000]={2, -1, 3, -4, 1, -2, -1, 5, -4}, len=9; int cur_max, tmp_max, strt_idx, sub_arr_idx; cur_max = arr[0]; for(strt_idx = 0; strt_idx < len; strt_idx++) { tmp_max=0; for(sub_arr_idx = strt_idx; sub_arr_idx < len; sub_arr_idx++) { tmp_max +=arr[sub_arr_idx]; if(tmp_max > cur_max) _____________; } } printf("%d",cur_max); return 0; }</code></pre> <p>Which line should be inserted to complete the above code?
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Dynamic Programming - Maximum Sum of Continuous Subarray - Quiz No.1.
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes