Binary Tree

I have just been researching this topic and I was wondering what type of application might a binary tree be used for. For instance what type of application would be a good showcase for a binary tree that I could write as an example?

Binary means two choices; as in left-right, up-down, yes-no, ...

One real-life application is the game '20 questions'. Twenty questions are asked and by the end, there should be a guess (perhaps correct) of the answer.

For instance, guess the state in US:
1) Is the name one word -- NO
2) Does the state border an ocean -- YES
3) Is it an original 13 state -- YES

Without continuing, the answer is -- Rhode Island.

Thus, questions need to be decided, and a matching file created that maps out the YES/NO answers.

Does that make sense?

I think so yes. Thanks for your reply. Does C++ have any built in classes to handle binary trees or do I have to do all the plumbing myself?

Also another application is the use of heaps - usually binary trees with a specific order: All elements to left are smaller than the node, the elements on the right are bigger.

This is good if you need any form of ordered data, because search is done faster than in a simple list ( O(log n) instead of O(n) )

Binary tree

In computer science, a binary tree is a tree data structure in which each node has at most two child nodes, usually distinguished as "left" and "right". Nodes with children are parent nodes, and child nodes may contain references to their parents. Outside the tree, there is often a reference to the "root" node (the ancestor of all nodes), if it exists. Any node in the data structure can be reached by starting at root node and repeatedly following references to either the left or right child.

Binary trees are used to implement binary search trees and binary heaps.

lcm.csa.iisc.ernet.in/dsa/node88.html
you can find application here

---------- Post updated at 08:24 AM ---------- Previous update was at 08:21 AM ----------

following are some more applications

  • binary earch tree - Used in many search applications where data is constantly entering/leaving, such as the map and set objects in many languages' libraries.
  • binary search partiton- Used in almost every 3D video game to determine what objects need to be rendered.
  • Used in almost every high-bandwidth router for storing router-tables.