What Will Be The Time Complexity Of The Given Codep Pre Langc #1148
What will be the time complexity of the given code?</p> <pre><code class="language-c"> #include <stdio.h> #include <string.h> #include<iostream> using namespace std; void swap(char *x, char *y) { char temp; temp = *x; *x = *y; *y = temp; } void func(char *a, int l, int r) { int i; if (l == r) cout<<a<<” ,”; else { for (i = l; i <= r; i++) { swap((a+l), (a+i)); func(a, l+1, r); swap((a+l), (a+i)); } } } int main() { char str[] = "AB"; int n = strlen(str); func(str, 0, n-1); return 0; } </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 Number Theory - Generating Permutations - 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