This is under the assumption that all my nodes represent simple integers. Note that in the above sample, I am making comparisons directly on the node value itself. While currentNode.Value value And Not nextNode Is NothingĮnd If End While If currentNode.Value = value ThenĬonsole.WriteLine( ' Duplicate value (' & _ Public Sub AddtoTree( ByVal value As Object) In terms of implementation, a binary tree is a type of a linked list of nodes. In this article we shall see a very simple binary tree implementation. Various low level data structures of the file system and databases would be a heap. For example, the Heap is an implementation of the binary tree. There are countless variations to the basic the Binary tree defined and each of these have various applications. A left or right sub tree can be empty and each element off the binary tree is called as the node.' The definition itself is recursive in nature and might sound cryptic. The other two subsets are themselves binary trees, called left and right sub trees of the original tree. The first subset contains a single element called root of the tree. 'A binary tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets. The basic definition can be given as follows (as mentioned in one of the data structures book by Tenenbaum). Binary tree is one of the most important data structures in the programming world.