+ 2

What is a binary tree

can someone please explain what a binary tree is and where they are applied in programming

23rd Apr 2017, 12:49 PM
Ben Ntabo
Ben Ntabo - avatar
4 Answers
+ 22
Binary Search Trees / Binary Trees are a data structure in which you have a node of data and two children of that node who also have children, who also have children and so on. They can be applied to use in compilers. During the construction of a parser, you can build a tree. When you enter into the semantical portion of the parser, when the tree has been built, you can traverse the tree and do type checking, and start preparing for intermediate code generation. But thats just one implementation.
23rd Apr 2017, 2:35 PM
SoraKatadzuma
SoraKatadzuma - avatar
+ 14
If every node has at most 2 child nodes, it's called a binary tree.
23rd Apr 2017, 1:17 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 9
one example for usage would be a Binary Search Tree (BST in short) one of the properties of BST is that the left child is smaller than the parent node and the right child is bigger this property makes searching in a BST very fast https://en.m.wikipedia.org/wiki/Binary_search_tree
23rd Apr 2017, 1:23 PM
Burey
Burey - avatar
+ 1
thanks all of you
26th Apr 2017, 4:03 PM
Ben Ntabo
Ben Ntabo - avatar