Found 422 Questions for Algorithms

k-ary tree in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:46:48
In this section we will see what is the K-ary tree. The K-ary tree is a rooted tree, where each node can hold at most k number of children.If the value of k is 2, then this is known as binary tree. The binary tree, or ternary trees are some specialized k-ary trees. So k-ary trees re generalized.Example of K-ary Tree −In the above example, there is a root. The root has four children. Each child of root has some children also. The first child has three children, the second child has no child, the third one has two children, ... Read More

Rooted vs Unrooted Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:45:02
In this section we will see what are the differences between rooted and the unrooted trees. At first we will see some examples of Rooted, and Unrooted trees.Example of Rooted Tree −Example of Unrooted Tree −Basic Differences between rooted and Unrooted treesIn a rooted tree, each node with descendants represents the inferred most recent common ancestors of the descendants. In some trees, the edge lengths may be interpreted as time estimates.For the unrooted trees, there is no ancestral root. Unrooted trees represent the branching order, but do not indicate the root of the location of the last common ancestor.Read More

Unrooted binary tree in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:42:48
Here we will see the what is the unrooted binary tree. These trees are connected undirected graph with no cycle. The vertices with one neighbor are the leaves of the tree. Remaining vertices are internal nodes. The degree of the vertices is its number of neighbors. In a tree with more than one node, the leaves are the vertices of degree one.Free tree is one type of binary tree, where all internal nodes have exactly degree three. In Computer Science, binary trees are often rooted, and ordered, when they are used as data structures, but the applications of unrooted binary ... Read More

Tournament Trees, Winner Trees and Loser Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:40:54
Here we will see the Tournament trees, Winner and Looser trees. The Tournament tree is a complete binary tree with n external nodes and n – 1 internal nodes. The external nodes represent the players, and the internal nodes are representing the winner of the match between the two players. This tree is also known as Selection tree.There are some properties of Tournament trees. These are like below −This tree is rooted. So the link in the tree and directed path from parent to children, and there is a unique element with no parentsThe parent value is less or equal ... Read More

Prefix and Postfix Expressions in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:38:14
The way to write arithmetic expression is known as a notation. An arithmetic expression can be written in three different but equivalent notations, i.e., without changing the essence or output of an expression. These notations are –InfixPrefixPostfixInfix notations are normal notations, that are used by us while write different mathematical expressions. The Prefix and Postfix notations are quite different.Prefix NotationIn this notation, operator is prefixed to operands, i.e. operator is written ahead of operands. For example, +ab. This is equivalent to its infix notation a + b. Prefix notation is also known as Polish Notation.Postfix NotationThis notation style is known ... Read More

Red-Black Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:35:48
In this section we will see what is the Red-Black Tree. The Red-Black Trees are self-balancing binary search tree. There are some conditions for each node. These are like below −Each node has color. Which is either Red or BlackThe root will be always blackThere will be no two adjacent Red nodesEvery path from a node (including root) to any of its descendent NULL node has the same number of black nodes.Example of Red-black treeRed-Black tree with Null Nodes at leafComparison with AVL TreeAVL Trees are more balanced than the Red-Black tree. But the major disadvantage is, there will be ... Read More

R-trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:28:32
Here we will see the R-Trees data structure. The R-Trees are used to store special data indexes in an efficient manner. This structure is very useful to hold special data queries and storages. This R-trees has some real life applications. These are like below −Indexing multidimensional informationHandling game dataHold geospatial coordinatesImplementation of virtual mapsOne example of R-Tree is like below.Corresponding R-tree is like below −Properties of R-TreesR-Trees are made of with single root, internal and leaf nodesThe root has a pointer to the largest region in the special domainThe parent nodes will hold child nodes where child nodes completely overlap ... Read More

The B-tree in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:26:24
Here we will see what are the B-Trees. The B-Trees are specialized m-way search tree. This can be widely used for disc access. A B-tree of order m, can have maximum m-1 keys and m children. This can store large number of elements in a single node. So the height is relatively small. This is one great advantage of B-Trees.B-Tree has all of the properties of one m-way tree. It has some other properties.Every node in B-Tree will hold maximum m childrenEvery node except root and leaves, can hold at least m/2 childrenThe root nodes must have at least two ... Read More

Merge Algorithms in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:24:45
The Merge algorithm is used to merge two sorted list into one list. This algorithm is used in different cases. If we want to perform merge sort, then we need to merge the sorter lists into larger lists.The approach is simple. We take two lists, there will be two pointers. The first one will point to the element of the fist list, second one will point to the elements of the second list. Based on their values, the smaller element is taken from one of these two lists, then increase the pointer of that corresponding list. This operation will be ... Read More

Binary Trees as Dictionaries in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:21:18
When we try to implement abstract data type Dictionary, then the node associates with values. A dictionary is basically a set of keys, which must be elements drawn from a total ordering. There may be additional information, which are associated with each key, but it does not lead to any conceptual comprehension.If the dictionary is implemented using trees, then each node will hold unique keys. Here for each node u in the tree, every key is u.l is strictly smaller than u.k. And every key in u.r, is strictly larger than u.k. A tree is organized according to this invariant ... Read More
Advertisements