Data Structure(Types of Tree in Data Structures)

 

Types of Tree in Data Structures:

General Tree

The general tree is the type of tree where there are no constraints on the hierarchical structure.

Properties

  • The general tree follows all properties of the tree data structure.
  • A node can have any number of nodes.

Trees-Soni/general-tree

Binary Tree

A binary tree has the following properties:

Properties

  • Follows all properties of the tree data structure.
  • Binary trees can have at most two child nodes.
  • These two children are called the left child and the right child.

Trees-Soni/binary-tree.

Binary Search Tree 

A binary search tree is a type of tree that is a more constricted extension of a binary tree data structure.

Properties

  • Follows all properties of the tree data structure.
  • The binary search tree has a unique property known as the binary search property. This states that the value of a left child node of the tree should be less than or equal to the parent node value of the tree. And the value of the right child node should be greater than or equal to the parent value.

Trees-Soni/binary-search-tree1.

AVL Tree 

An AVL tree is a type of tree that is a self-balancing binary search tree.

Properties

  • Follows all properties of the tree data structure.
  • Self-balancing.
  • Each node stores a value called a balanced factor, which is the difference in the height of the left sub-tree and right sub-tree.
  • All the nodes in the AVL tree must have a balance factor of -1, 0, and 1.

Trees-Soni/AVL-TREE.

Red-Black Tree

  • A red-black tree is a self-balancing binary search tree, where each node has either the color of red or black.
  • The colors of the nodes are used to make sure that the tree remains approximately balanced during insertion and deletion.

Properties

  • Follow all properties of binary tree data structure.
  • Self-balancing.
  • Each node is either red or black.
  • The root and leaves nodes are black.
  • If the node is red, then both children are black.
  • Every path from a given node to any of its nodes must go through the same number of black nodes.

/RED-BLACK-TREE

Splay Tree

A splay tree is a self-balancing binary search tree.

Properties

  • Follows properties of binary tree data structure.
  • Self-balancing.
  • Recently accessed elements are quicker to access again.

After you perform operations such as insertion and deletion, the splay tree acts, which is called splaying. Here it rearranges the tree so that the particular elements are placed at the root of the tree.

SPLAY-TREE

Treap Tree

The Treap tree is made up of a tree, and the heap is a binary search tree.

Properties

  • Each node has two values: a key and a priority.
  • Follows a binary search tree property.
  • Priority of the treap tree follows the heap property.

TREAP-TREE.

Comments

Popular posts from this blog

String Functions in C Language(C Language)

PHP Array Functions

Home Menu Options in Ms Word