What is the time complexity T(n) of the following program? a) int n, d, i, j; cin >> n; for (d=1; d<=n; d++) for (i=1; i<=d; i++) for (j=1; j<=n; j += n/10) cout << d << " " << i << " " << j << endl; b) void main() { int n, s, t; cin >> n; for (s = 1; s <= n/4; s++) {t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } } c) void main() { int n, r, s, t; cin >> n; for (r = 2; r <= n; r = r * 2) for (s = 1; s <= n/4; s++) { t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } }
3 10597Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and calculate its complexity T(n).
1 7144write a c program, using for loop, that accepts and odds two numbers. The output must be the sum and the addens. This should be repeated 5 times while the first number is decremented by one and the second number is incremented by 1.
2 9235Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.
5 16874Post New Infosys C++ Code Interview Questions
I want to understand what is BTS? What are its different configurations and what is the power consumption/peak current for each of these types of BTS?
What is customer credit management according to you?
Explain what is the difference between "picklist generic" and "picklist hierarchical" business components?
Do servers only get paid by tips at BBW?
What can I use instead of union in sql?
Explain the difference between txdatasource and datasource?
What is kafka topic?
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
Is django backend or frontend?
Why singleton pattern is better than creating singleton class with static instance?
Define operators used in perl?
How do you select certain words in word?
Explain inversion of control and dependency injection through a simple example.
Explain about folder?
What is the role of iis?