retagged by
6,764 views
3 votes
3 votes

A balance factor in AVL tree is used to check

  1. what rotation to make
  2. if all child nodes are at same level
  3. when the last rotation occurred
  4. if the tree is unbalanced
retagged by

2 Answers

5 votes
5 votes
A balancing factor in the AVL tree is used to check whether the tree is balanced or not.

Balance Factor of Node A = Height of right subtree of A - Height of left subtree of A.

The allowed balance factors are {-1,0,1}. Otherwise, the node is unbalanced.

If any node is unbalanced we cannot guarantee O(log n) search time. Therefore, AVL tree uses the concept of Balance Factor.

Hence, Option D is the correct option.
1 votes
1 votes
AVL trees are self balancing therefore have BF [-1,0,1]. The BF is checked to guess the rotation in tree. Option 3 is correct.
Answer:

Related questions

2.1k
views
0 answers
5 votes
admin asked Mar 30, 2020
2,080 views
What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head==NULL) return ... list in reverse orderPrints alternate nodes of Linked ListPrints alternate nodes in reverse order
1.7k
views
0 answers
4 votes
admin asked Mar 30, 2020
1,668 views
Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has ...
1.3k
views
4 answers
2 votes
admin asked Mar 30, 2020
1,325 views
Let $A$ be a square matrix of size $n\times n$. Consider the following program. What is the expected output?C=100 for i=1 to n do for j=1 to ... upper diagonal elements and subtracting $100$ from diagonal elements of $A$.None of the option.
1.3k
views
3 answers
4 votes
admin asked Mar 30, 2020
1,289 views
Assume that the operators $+,-,\times$ are left associative and $\wedge$ is right associative. The order of precedence(from highest to lowest) is $\wedge,\times, +,-$. ... $-+a\times bc\wedge\wedge def$