1.2k views
Which of the following need not be a binary tree?
(a) Heap (b) B-Tree
(c) AVL- Tree (d) None of these
in DS | 1.2k views
+1
Heap need not be always binary , it may be $d_{ary}$ heap
+1
A B-Tree is not a binary tree , it may be n-ary tree
+2
(b) B-Tree
0
Heap needn't be a binary tree always. The only requirement to be a heap is it should be a complete tree.
0
@smsubham : your argument is valid $\text{iff}$ Heap is a $\text{binary heap}$
0

By mistake added binary in 2nd sentence. Check now.

Heap Variants:

• 2-3 heap
• Binary heap
• Many many others
0

The only requirement to be a heap is it should be a complete tree.

also $\text{Almost complete binary tree}$

0
What is the difference between complete and almost complete binary tree?
0
0
Saw that before asking, But things aren't clear there. Can you give an example which is complete BT but not almost complete BT and vice versa?
+1

if last level of the tree are completely fill then it is complete binary tree

and if 2nd last level are completely filled but the last level is not completely filled then it is almost complete binary tree

0

So definition and examples given here are wrong i suppose.

https://www.geeksforgeeks.org/binary-tree-set-3-types-of-binary-tree/

According to it:

Complete Binary Tree: A Binary Tree is complete Binary Tree if all levels are completely filled except possibly the last level and the last level has all keys as left as possible

Following are examples of Complete Binary Trees

               18
/       \
15         30
/  \        /  \
40    50    100   40

18
/       \
15         30
/  \        /  \
40    50    100   40
/  \   /
8   7  9 
+1
first one is complete and other is almost complete  binary tree
0
If there is another option(e) Search Tree then can "Option (e) - Search Tree" also be an answer? Because search tree can be a "Ternary search tree" and need not to be binary.
0

is it both a and b

Will be both Heap and B tree.

 Heaps Definition: A heap is a specialized tree-based data structure that satisfied the heap property: if B is a child node of A, then key(A) ≥ key(B). This implies that an element with the greatest key is always in the root node, and so such a heap is sometimes called a max-heap. Of course, there's also a min-heap. Variants: 2-3 heap Binary Heap Many many others Binary heap storage rules  -- A heap implemented with a binary tree in which the following two rules are followed: The element contained by each node is greater than or equal to the elements of that node's children. The tree is a complete binary tree.

So heap needn't be binary always.

AVL tree is BST with balancing factor.

by Loyal (9.2k points)
0
@smshubham : you are half correct.

you have wriiten that $\text{B tree}$ are not necessarily binary .It is correct.where is your explanation?
0

@sourav

The B-tree is a generalization of a binary search tree in that a node can have more than two children

+1 vote
B tree...................... B trees need not be the binary tree. B trees may have more than 2 children....

order of B tree is max. no. of children a node can have..
by Active (2.3k points)
0

let me see a binary tree with more than 2 children!!!!

+2
binary tree always have  2 children...but B trees need not be only 2 children it may have more than 2 children.....
0

Priyanka Agarwal  yes you are right

0
I don't think this is correct. Check my answer.
+1 vote
b) B-Tree
by (201 points)
B-Tree is the answer as it can bee m-ary .

heap is almost complete binary tree and AVL tree is height balanced binary tree.
by (41 points)

1
2