1. Consider the following algorithm:
for ( i = 1 ; i <= 1 . 5 n ; i++)
cout << i ;
for ( i = n ; i >= 1 ; i - - )
cout << i ;
(a) What is the output when n = 2, n = 4, and n = 6?
(b) What is the time complexity T(n)? You may assume that the input n is divisible by 2.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More AI Algorithms Interview Questions

Define Routing Algorithm?

0 Answers   Maveric,


What is meant by a * search algorithm?

0 Answers  


What is Na?ve Bayes Algorithm?

2 Answers  


Which search algorithm will use a limited amount of memory in online search?

0 Answers  


How does deep learning contrast with other machine learning algorithms?

0 Answers  






Explain the concept behind dead lock avoidance, banker's algorithm.

0 Answers   HPCL, Hughes Systique Corporation,


Which is the most straight forward approach for planning algorithm?

0 Answers  


Which is the most straight forward approach for planning algorithms?

0 Answers  


Consider the following algorithm: for ( i = 2 ; i <= n ; i++) { for ( j = 0 ; j <= n) { cout << i << j ; j = j + floor(n/4) ; } } (a) What is the output when n = 4 (b) What is the time complexity T(n). You may assume that n is divisible 4.

0 Answers  


What are the disadvantages of breadth-first search algorithm?

0 Answers  


What is local search algorithms?

0 Answers  


Tell briefly about the Banker's algorithm and what is it used for?

0 Answers   Impetus,


Categories