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
My friend collects antique stamps. She purchased two, but found that she needed to raise money urgently. So she sold them for Rs. 8000 each. On one she made 20% and on the other she lost 20%. How much did she gain or lose in the entire transaction?
Tanya wants to go on a date and prefers her date to be tall, dark and handsome. 1. Of the preferred traits - tall, dark and handsome - no two of Adam, Bond, Cruz and Dumbo have the same number. 2. Only Adam or Dumbo is tall and fair. 3. Only Bond or Cruz is short and handsome. 4. Adam and Cruz are either both tall or both short. 5. Bond and Dumbo are either both dark or both fair. Who is Tanya's date?
Sam and Mala have a conversation. ? Sam says I am certainly not over 40 ? Mala says I am 38 and you are atleast 5 years older than me ? Now Sam says you are atleast 39 All the statements by the two are false. How old are they really?
A B C D E F G H I Each of the digits from 1 to 9 is represented by a different letter above. Also, A + B + C = C + D + E = E + F + G = G + H + I = 13 Which digit does E represent?
Ek nadi ka Name Ek Ladki ka Name Ek PHOOL ka Name 3 sawalon ka jawab ek hi hona chahiye wo bhi Ek film ka Name hai...........
46 Answers Ansor, Eagle, FGG, Ganga, Godavari, Infosys, JPSC Jharkhand Public Service Commission, Nilkamal, Parimal, Shani, Sola, SSC, Ugar,
2. At a recent painting competition, jonneys rendition of a constable was not last. priya only just managed to avoid last place and came third. the lady who painted a monkey was very successful and took first place. mary beat the lady who painted the temple and the lady who painted the flower beat sachin. can you determine who painted what and who won?
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?
name the cities which consist of a fruit name in its starting?
if you are running in the race and you overtakes 2nd no player then whats your position?
What is the smallest whole number that, when divided by 2, leaves a remainder of 1; when divided by 3, leaves a remainder of 2; and so on, up to leaving a remainder of 9 when divided by 10?
24 Answers ASD Lab, Athena Health Care,
what makes a road as abroad?
You have 13 balls which all look identical. All the balls are the same weight except for one. Using only a balance scale, can find the odd one out with only 3 weighings? Is it possible to always tell if the odd one out is heavier or lighter than the other balls?