Question: Look at the program below. Which of the three functions above (runtime_increment, runtime_print and runtime_pow) has the time complexity 'closer' (or more similar) to that

Look at the program below. Which of the three functions above (runtime_increment, runtime_print and runtime_pow) has the time complexity 'closer' (or more similar) to that of the runtime_rec? # include # include # include void runtime_rec(int N, char * str) { if (N == 0) { //printf ("%s ", str): return: } str[N - 1] = 'L': runtime_rec(N - 1, str): str[N - 1] = 'R': runtime_rec(N - 1, str): } int main(int argc, char** argv) { int N = 0: char ch: char str[100]: printf("run for: N -"): scanf("%d", &N): str[N] = '\0': \\ to use it as a string of length N. runtime_rec(N, str): } Look at the program below. Which of the three functions above (runtime_increment, runtime_print and runtime_pow) has the time complexity 'closer' (or more similar) to that of the runtime_rec? # include # include # include void runtime_rec(int N, char * str) { if (N == 0) { //printf ("%s ", str): return: } str[N - 1] = 'L': runtime_rec(N - 1, str): str[N - 1] = 'R': runtime_rec(N - 1, str): } int main(int argc, char** argv) { int N = 0: char ch: char str[100]: printf("run for: N -"): scanf("%d", &N): str[N] = '\0': \\ to use it as a string of length N. runtime_rec(N, str): }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
