You are on page 1of 4

With respect to both terms, any digital encoding or decoding system that has two

alternative states of a numbering structure—in which each digit can have one of two

values, 0 or 1—can be thought of as binary. A non-linear hierarchical data structure

with nodes connected by edges is referred to as a "Tree". As a result, a binary tree in

computer science is described as a collection of discrete pieces of information or

elements that are frequently called nodes. [Shaffer, 2011, p. 153].

A binary tree is a kind of non-linear data structure that is similar to a tree. It is made

up of nodes that have a maximum of two offspring for each parent, or a left and a

right sub-tree or child. A node without offspring is referred to as a leaf node, while the

node at the top of the tree is frequently referred to as the Root or parent. One

interesting characteristic about binary trees is that they can store data hierarchically,

which is why their main applications are in data sorting and search. "Some common

operations that can be conducted on binary trees include insertion, deletion, and

traversal." Bredlung, 2022, paragraph 3.

Binary trees facilitate connections between different nodes, either logically or through

the use of mechanics like pointer holding because they convey data in and through

node objects. As stated by Shaffer (2011). "A "binary" tree has the feature that no

node can be connected to more than two other nodes. Regarding the "tree," it is stated

that each node is only allowed to have one link pointing toward it. Any binary tree's

root node is always the starting point for all tree operations because it is ideally

regarded as the first node. Knowing how to get the Root is essential when working

with binary trees. A binary tree's Node, including the Root, can contain two pointers,

or logical ways to point to two separate nodes; this causes the portion of the tree

below that node to be divided into two Sub-trees.


The greatest number of nodes at the same level, or along the same lengthy path from

the Root, is known as the binary tree weight. Last but not least, a "terminal" node is

the term leaf. Additionally, this node is free to hang on the tree because it doesn't

point to any other nodes.

Although there are undoubtedly more approaches to implementing a binary tree, the

two most popular ones are covered in the textbook and are as follows:

1. Implementation utilizing pointers. According to Shaffer (2011), p. 163-170,

this solution uses a class for a node, with two members storing pointers to the

other two nodes or, in the case that this is a terminal node for a subtree, a Null

value.

2. Implementation using arrays. Here, the nodes are kept in an array for storage.

Though the left and right node positions of an array can be mathematically

determined, there are no pointers. According to Shaffer (2011), pp. 170–171,

this approach is suitable for entire binary trees, like a heap data structure.

The implementation of a binary tree using pointers is shown here, with each Node

holding a value

and two child

pointers.

Shaffer (2011), p. 165, is credited.


This is an additional Java example of a pointer-based node:

The implementation

of arrays:

The array above produced the following tree:

Consequently, it is possible to determine the left and right nodes' given positions.

Reference:
Shaffer, C. (2011). Blacksburg: Virginia. Tech. Retrieve from. A Practical

Introduction to Data Structures and Algorithm Analysis

Baeldung, (2022). Application of Binary Trees. Retrieved from

https://www.baeldung.com/cs/applications-of-binary-trees

You might also like