C++ Code Interview Questions

what is the best algorithm to sort out unique words from a list of more than 10 million words(1 crore+)? we need the best technique in the terms of execution time.

TCS,

13712

How to Split Strings with Regex in Managed C++ Applications?

2602

Code for Method of Handling Factorials of Any Size?

1486

Code for Easily Using Hash Table?

1834

Code for Two Classes for Doing Gzip in Memory?

2211

Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2063

Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?

TCS,

10779

Given 1 to n distinct random number of which n+1th element was duplicated. How do find the duplicate element and explain the time complexity of the algorithm.

2521

Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.

5361

Deriving time complexity of Binary tree and AVL tree, step by step.

12958

How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.

15172

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--; } } }

7219

Coin Problem You are given 9 gold coins that look identical. One is counterfeit and weighs a bit greater than the others, but the difference is very small that only a balance scale can tell it from the real one. You have a balance scale that costs 25 USD per weighing. Give an algorithm that finds the counterfeit coin with as little weighting as possible. Of primary importance is that your algorithm is correct; of secondary importance is that your algorithm truly uses the minimum number of weightings possible. HINT: THE BEST ALGORITHM USES ONLY 2 WEIGHINGS!!!

13136

Show by induction that 2n > n2, for all n > 4.

5106

Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

6108

Un-Answered Questions { C++ Code }

write a program to perform generic sort in arrays?

1978

A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

1780

write a program that reverses the input number of n.Formulate an equation to come up with the answer.

6144

write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

3819

Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1561

i don't know about working of nested for loop can any one help me

1297

How to Split Strings with Regex in Managed C++ Applications?

2602

We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

3425

i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1427

Code for Method of Handling Factorials of Any Size?

1486

find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

1402

Code for Two Classes for Doing Gzip in Memory?

2211

Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

6108

write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

1836

Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

2801