You are on page 1of 3

Threaded Binary Tree

The idea of threaded binary trees is to make inorder traversal faster and do it without stack and without
recursion. A binary tree is made threaded by making all right child pointers that would normally be NULL point
to the inorder successor of the node (if it exists).
A threaded binary tree is a type of binary tree data structure where the empty left and right child pointers in a
binary tree are replaced with threads that link nodes directly to their in-order predecessor or successor,
thereby providing a way to traverse the tree without using recursion or a stack.
Threaded binary trees can be useful when space is a concern, as they can eliminate the need for a stack during
traversal. However, they can be more complex to implement than standard binary trees.
There are two types of threaded binary trees.
Single Threaded: Where a NULL right pointers is made to point to the inorder successor (if successor exists)
Double Threaded: Where both left and right NULL pointers are made to point to inorder predecessor and
inorder successor respectively.

What is Binary Search Tree?


Binary Search Tree is a node-based binary tree data structure which has the following properties:
The left subtree of a node contains only nodes with keys lesser than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search tree.

Complete Binary Tree


A complete binary tree is a binary tree in which all the levels are completely filled except possibly
the lowest one, which is filled from the left.
A complete binary tree is just like a full binary tree, but with two major differences
All the leaf elements must lean towards the left.
The last leaf element might not have a right sibling i.e. a complete binary tree doesn't have to be a
full binary tree.

Tail recursion is a specific form of recursion in programming where the recursive call is the last
operation performed in a function. In other words, the result of the recursive call is directly returned without
any further computation. This is significant because some programming languages and compilers can optimize
tail-recursive functions to use constant stack space, essentially converting the recursion into an iterative loop.
B Tree
B Tree is a specialized m-way tree that can be widely used for disk access. A B-Tree of order m can
have at most m-1 keys and m children. One of the main reason of using B tree is its capability to store large
number of keys in a single node and large key values by keeping the height of the tree relatively small.
A B tree of order m contains all the properties of an M way tree. In addition, it contains the following
properties.
Every node in a B-Tree contains at most m children.
Every node in a B-Tree except the root node and the leaf node contain at least m/2 children.
The root nodes must have at least 2 nodes.
All leaf nodes must be at the same level.
It is not necessary that, all the nodes contain the same number of children but, each node must have m/2
number of nodes.

B + Tree
B+ tree is a variation of the B-tree data structure. In a B + tree, data pointers are stored only at the leaf nodes
of the tree. In a B+ tree structure of a leaf node differs from the structure of internal nodes. The leaf nodes
have an entry for every value of the search field, along with a data pointer to the record (or to the block that
contains this record). The leaf nodes of the B+ tree are linked together to provide ordered access to the search
field to the records. Internal nodes of a B+ tree are used to guide the search. Some search field values from
the leaf nodes are repeated in the internal nodes of the B+ tree.

You might also like