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
Hi Friends, Myself shiwani i had 11 years gap in my study and rite now i am 26 years,i enrolled myself in b.com and rite now i am in my second year and also pursuing CS(company secretary)and doing job in accounts department drawing 25000/-p.m,after completing my graduation and some level of cs module,would like to apply in mnc,would it matter to them that i had 11 years gap in study,kindly please help,me worried alot.
do you have reference list?
0,2,4,8,14,24,34,...can ypu solve this series?
One sales man sold one box out of them and then he says, "I have the same number of red balls left out as that of blue." Which box is the one he solds out?
Consider a number 235, where last digit is the sum of first two digits i.e. 2 + 3 = 5. How many such 3-digit numbers are there?
A cow is standing 5 feet from the middle of the bridge .A train is at a distance of 2 times length of the bridge from direction in which cow is nearer to end of the bridge is coming at a speed of 90 miles/hour.If cow moves towards train it will be saved by 1 foot.If cow moves away from train it will be hit by three inches of cow (i)Find length of bridge (ii)Find cows speed
1 Answers eLitmus, Infosys, TCS,
In a group of 25, 13 can speak Latin, 15 can speak French, and 6 don’t speak either. How many of these speak both Latin and French?
give me an some aptitude question asked on interviews
Four friends - Arjan, Bhuvan, Guran and Lakha were comparing the number of sheep that they owned. It was found that Guran had ten more sheep than Lakha. If Arjan gave one-third to Bhuvan, and Bhuvan gave a quarter of what he then held to Guran, who then passed on a fifth of his holding to Lakha, they would all have an equal number of sheep. How many sheep did each of them possess? Give the minimal possible answer
Among 12 identical looking golf balls there is one that is defective in weight. It is either heavier or lighter than the standard one. You have a balance. You can only weigh 3 times to find out which one is defective and whether it is heavier or lighter.
During a recent school reunion,four men were discussing their starting salaries back in 1962.The salaries in question were 8,10,12 and 14 thousand pounds per year.of course the MP earned the most.Alan earned more thean brain and the doctor earnd more than Derek,the vet.charles could not remember what he started on.Brain,the lawyer,didnot start on 10,000pounds nor did Derek.can you determine who has which job and their starting salaries?
why do you want to work here?