What Will Be The Recurrence Relation Of The Following Code P #1861
What will be the recurrence relation of the following code? </p> <pre><code class="language-c"> Int sum(int n) { If(n==1) return 1; else return n+sum(n-1); }</code></pre>
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 Recursion - Master’s Theorem - Quiz No.2.
What will be the recurrence relation of the following code?
Int sum(int n) { If(n==1) return 1; else return n+sum(n-1); }
T(n) = T(n/2) + n
T(n) = T(n-1) + n
T(n) = T(n-1) + O(1)
T(n) = T(n/2) + O(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