Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Check the code given below:int n;int A [100] ... Start Learning for Free
Check the code given below:
int n;
int A [100] ;
void x ( )
{
int i ;
for (i = n/2 ; i > = 1; i --)
y(i);
while (n > 1)
{
y (1);
}
}
void y (int i)
{
....
....
....
}
Let the complexity of y be O (log2 n). Then, the complexity of x will be
  • a)
    O (n)
  • b)
    O (n log2 n) 
  • c)
    O(n2 log2 n)
  • d)
    O (n2)
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i...
In this programme, 'for' loop runs n/2 times and in this "for loop", function y (i) has (log2 n) time complexity.
In the above, we will select maximum time complexity, i.e. n/2 log2 n.
Then, the total time complexity for the "for loop" will be O (n log2 n).
Free Test
Community Answer
Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i...
The code provided is incomplete. The for loop condition is missing after "i =" in line 3. Can you please provide the complete code so that I can assist you better?
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer?
Question Description
Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer?.
Solutions for Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer?, a detailed solution for Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Check the code given below:int n;int A [100] ;void x ( ){int i ;for (i = n/2 ; i > = 1; i --)y(i);while (n > 1){y (1);}}void y (int i){............}Let the complexity of y be O (log2 n). Then, the complexity of x will bea)O (n)b)O (n log2 n)c)O(n2 log2 n)d)O (n2)Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev