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
How long would it take you to count 1 billion orally if you could count 200 every minute and were given a day off every four years?
Three convicts are brought into the warden's office. He says he can parole one of them and to decide which one he will parole he takes out 5 hats (3 red and 2 white). He stands behind them and places a hat on each one of their heads and puts the other two remaining hats in a drawer. He tells the prisioners they can look at the others hats and if they can tell which hat they have on they will be the one who is paroled. The first man looks at the other two and says, "I don't know." The second man looks at the others hats and says, "I don't know." The third man who is blind says, "Even though I have not the gift of sight I can tell by what the others have said that the color of my hat is..." What color is the blind mans hat and how does he know?
2 Answers Bally Technologies, Walkover, Wipro,
*suppose u have 2 distribute a sum rs 50 among 30 studnt .it is also decided that a male student will get double than of female student.find the no. of male n female student of class?
Three boxes labeled as red, blue and mixed.These labels are incorrect.one box contains red balls and another box contains blue balls and remaining one box contains both red and blue balls. Pickup one ball from any box(u should pickup ball only once) and name the correct labels.
7 Answers 3D PLM, Exilant, IBM, NDS, Oracle, SofTech, Sports Keeda, The Advisory Board Company, Zycus Infotech,
If 5/2 artists make 5/2 paintings using 5/2 canvases in 5/2 days then how many artists r required to make 25 paintings using 25 canvases in 25 days?
there r 100 people who buys juice if v take 500 random sample we find 75 people who buys juice then how many random sample they need 2 find remaining 25 buyers
In a certain year, the number of girls who graduated from City High School was twice the number of boys. If 3/4 of the girls and 5/6 of the boys went to college immediately after graduation, what fraction of the graduates that year went to college immediately after graduation?
2-3 ques on GDP growth rate ?
A worker earns a 5% raise. A year later, the worker receives a 2.5% cut in pay, & now his salary is Rs. 22702.68 What was his salary to begin with?
Outside a room there are three light switches. Each switch is connected to a different light bulb inside the room. Each of the three switches can be either 'ON' or 'OFF'. You are allowed to set each switch the way you want it, once, and then enter the room. Your task is to then determine which switch controls which bulb. How can you do it?
Write 1111......(243 times) i.e. a 243 digit number with all 1s. Prove that it is divisible by 243.
A fly is flying between two trains, each travelling towards each other on the same track at 60 km/h. The fly reaches one engine, reverses itself immediately, and flies back to the other engine, repeating the process each time. The fly is flying at 90 km/h. If the fly flies 180 km before the trains meet, how far apart were the trains initially?