15. The nodes in a binary tree in preorder and inorder sequences are as follows: preorder: ABCDEFGHIJKLM inorder: CEDFBAHJIKGML
Write a program to search the array element. Enter a value from the keyboard and find out the location of the entered value in the array. If the entered number is not found in the array display the message
What is the output of the following C++ code?
x = 100;
y = 200;
if (x > 100 && y <= 200)
cout << x << " " << y << " " << x + y << endl;
else
cout << x << " " << y << " " << 2 * x - y << endl;
Suppose that str1, str2, and str3 are string variables, and str1 = "English", str2 =
"Computer Science", and str3 = "Programming". Evaluate the following expressions.
a. str1 >= str2
b. str1 != "english"
c. str3 < str2
d. str2 >= "Chemistry"
Using the looping statement. Create a program that will display the following:
Create a C++ program that inputs 2 numbers and prints them out. Then print the next 10 numbers in the sequence, where the next number is the sum of the previous two.
Sample Output:
Enter the first number: 1
Enter the second number: 3
1 3 4 7 11 18 29 47 76 123 199 322
define a class license that has a driving number ,name and address.define constructors that take on parameter that is just the number and another where all parameters are present.
Given two strings x and y, find the longest common subsequence and its length.
Sample Input 1:
x = “ABCBDAB”
y = “BDCABA”
Sample output 1:
longest common subsequence = “BCBA”
longest common subsequence length = 4
Sample Input 2:
x = “ABBACQ”
y = “XAYZMBNNALQCTRQ”
Sample output 2:
longest common subsequence = “ABACQ”
longest common subsequence length = 5
You’re given n boxes of chocolates arranged sequentially. Each box contains ai chocolates. You have to pick the maximum number of chocolates from the boxes and you must follow the given rule: ● You cannot pick chocolates from two consecutive boxes Let me explain the rule. If you pick chocolates from the ith box, you are not allowed to pick chocolates from the i+1th box or i-1 th box. The first line of the input represents n (2<=n<=1000), the number of boxes, and the following line represents the number of chocolate of those n boxes. Print the maximum number of chocolates you can collect from the boxes with satisfying the condition.
Sample Input :
8
1 2 3 4 5 6 7 8
Sample Output: 20
Sample Input 3:
5
2 50 100 75 1
Sample Output:
125
There are two trucks on the roads and you have n boxes. You want to carry all of the boxes from Dhaka to Sylhet using these two trucks. Remember, you must use these two trucks together. You know the weight of each box. One of the truck drivers is very lazy to start the truck so that he hit upon a plan. He said to you, “If the load of two trucks is not equal, then they will not start the trucks”. Can you please figure out whether it is possible to bring those n boxes to Sylhet using those two trucks? The first line of the input represents n (2<=n<=1000), the number of boxes, and the following line represents the weight of those n boxes. The maximum weight of each box can be 100. Print YES if it is possible to divide the boxes in such a way that the load of two trucks is equal, otherwise print NO.
Sample Input 1:
5 2 3 6 2 1
Sample Output 1:
YES
Sample Input 3:
4 2 4 2 2
Sample Output 3:
NO