Given a sequence of integers, there are a few sequences
which result in balanced
binary search trees i.e., AVL trees. Write a program that
takes a sequence of integers
as input and outputs the number of such sequences that
result in the balanced binary
search trees.
Input Format:
Single line contains sequence of integers terminated by -1.
Output format:
Print the number of AVL tree possible from that input sequence.
Sample Input:
1 2 3 -1
Sample Output:
2
No Answer is Posted For this Question
Be the First to Post Answer
There are 3 colored boxes - Red, Green and Blue. Each box contains 2 envelopes. Each envelope contains money - two of them contain Rs. 25000 each, two of them contain Rs. 15000 each and remaining two contain Rs. 10000 each. There is one statement written on the cover of each box. * Red Box: Both, a red box and a blue box contain Rs. 10000 each. * Green Box: Both, a green box and a red box contain Rs. 25000 each. * Blue Box: Both, a blue box and a green box contain Rs. 15000 each. Only one of the above 3 statements is true and the corresponding box contains the maximum amount. Can you tell which box contains the maximum amount and how much?
At the Party: 1. There were 9 men and children. 2. There were 2 more women than children. 3. The number of different man-woman couples possible was 24. Note that if there were 7 men and 5 women, then there would have been 35 man-woman couples possible. Also, of the three groups - men, women and children - at the party: 4. There were 4 of one group. 5. There were 6 of one group. 6. There were 8 of one group. Exactly one of the above 6 statements is false. Can you tell which one is false? Also, how many men, women and children are there at the party?
Substitute digits for the letters to make the following Division true Y F Y ----------- A Y | N E L L Y | N L Y ---------------- P P L P N H ---------- N L Y N L Y ---------- 0 0 0 Note that the leftmost letter can't be zero in any word. Also, there must be a one-to-one mapping between digits and letters. e.g. if you substitute 3 for the letter N, no other letter can be 3 and all other N in the puzzle must be 3.
There are 25 horses and only five tracks in a race. How do you find the second coming horse of all the 25 horses, provided there is no stop clock? (obviously, a horse cannot participate more than once in a race).
28 Answers Amazon, Athena Health Care, Bloomberg, Citrix, Dreamz Group, Global Analytics, Juniper Networks, Microsoft, Oracle, Synopsis, UC Berkeley,
agar mein aapko ek pen gift du aur aapko kahu ki aap us pen se mere haato me kuch likho jo mujhe hamesa yaad rahe to aap kya likhoge?
What is the smallest number which when divided by 10 leaves a remainder of 9, when divided by 9 leaves a remainder of 8, when divided by 8 leaves a remainder of 7, when divided by 7 leaves a remainder of 6 and so on until when divided by 2 leaves a remainder of 1?
Here is the family tree of Mr. RAHUL RAHUL | --------------------------------------------- | | | | RATISH YASH OM TRILOK | | ? -------- ------------------ | | | | | AMAR AMIT RAM HARSH ASHOK | | ----- ------- | | | | | How many children does Mr. TRILOK have?
You have 8 coins. 3 of them weigh x units, 3 y units, 1 a units and 1 b units. They are all mixed and look identical. You have to find the lightest coin in minimum number of weighing (balance)
You are seat in one room having switch board containing 3 switchs & its connection to bulb in another room (only one is right connection).terms- you can turn on max 2 buttons and once you can go to see the answer which is right one?
A man was looking at a portrait. Someone asked him, "Whose picture are you looking at?" He replied, pointing at the portrait: "Brothers and sisters have I none, but this man's son is my father's son." Now whose picture is the man looking at?
In a city, The police has surrounded the Bank. There are 50 people in the building. Each person is either an engineer or a manager of the bank. All computer files have been deleted, and all documents have been shredded by the managers.
can anyone provide the answer for the puzzle below There are 25 horses,in each race only 5 horses can participate.how many races are required to select best 5 horses out of 25. need answer with detailed explanation