Member-only story
Data Structures and Algorithms (DSA) using C# .NET Core — Trees and Binary Trees - I
Trees are one of the most common data structure used. A tree is a non-linear data structure that is used to store data in a hierarchical manner. In this article we will discuss about tree, then learn about binary tree along with an implementation of binary tree — the Binary Search Tree also knows as BST.
Tree definition: A tree consists of set of nodes or a collection of nodes connected by edges, such that the nodes have a parent child relationship. In a tree parent child relationship is established through edges. The nodes and edges are linked together (in one direction) to simulate the hierarchy. An example of tree is Fig. 1- Organizational chart
Similar to Organizational chart is the Tree structure: fig. 2
Some of the terminologies used in a Tree structure are:
1. Each node has a value, also referred to as key value.
2. The top node of a tree is call Root node. If node is connected by edge to other node, the top node is called the parent and the node below is called its children.