Found 423 Questions for Algorithms

B-tree Query in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:27:13
Here we will see, how to perform the searching in B-Tree. The B-Tree searching is also known as B-Tree Querying. Suppose we have a B-tree like below −Example of B-Tree −The searching technique is very similar to the binary search tree. Suppose we want to search 66 from the above tree. So we will start from root, now 66 is larger than root element 46. So we will move to the right child of the root. Then the right child has more than one element. The elements are sorted, they are [56, 81]. Our target key is larger than 56, ... Read More

Interval Heaps in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:19:04
Here we will see what is the interval heaps. The interval heaps are complete binary tree, in which, each node except possibly the last one contains two elements. Let the priorities of two elements in node P are ‘a’ and ‘b’. Here we are considering a ≤ b. We say that the node P represents the closed interval [a, b]. Here a is the left endpoint of the interval of P, and b is the right endpoint. The [c, d] is contained in the interval [a, b] if and only if a ≤ c ≤ d ≤ b. In an ... Read More

Max WBLT Operations in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:18:05
Here we will see what are the different Max-WBLT operations. The HBLT has different operations like insert, delete, and initializations. They are quite similar to the WBLT also. However, the meld operation can be done in a single top-to-bottom pass.A single pass meld operation is possible for WBLT. Because we can find the w values, on the way down. We can update the w values and swap subtrees as necessary. For HBLT, we cannot find the s values on the way down to the tree.As the meld can be done in a single top-to-bottom pass, then the insert and delete ... Read More

Weight-Biased Leftist Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:15:01
Here we will see another variation of Leftist Tree. Here we will consider the number of nodes in a subtree, rather than the length of a shortest path for root to external node. Here we will define the weight w(x) of node x, to be the number of internal nodes in the subtree with root x. If x is an external node, then the weight is 0. If x is internal node, then the weight is one more than the sum of weights of its children.Here is an example of Weight Biased Leftist Tree (WBLT) −Suppose the Binary tree is ... Read More

Deletion of Arbitrary Element from a Max HBLT in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:13:14
Deleting Arbitrary nodes from Max or Min HBLT is not standard operation. for Priority queue or HBLT. If we want to delete a node say K from HBLT, we have to follow following rules.Detach the subtree rooted at K, from the tree, and replace it with the meld of the subtrees of node K.Update s values from the path from K to the root, and swap subtrees on this path as necessary to maintain the property of HBLT.To update the s value from K to root, we need the parent pointer for each node. This operation for updating the s ... Read More

Multiple Lists in a Single Array in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:11:51
Array representation is basically wasteful of space when it is storing data that will change over time. To store some data, we allocate some space which is large enough to store multiple values in an array. Suppose we use the array doubling criteria to increase the size of the array.Consider the current array size is 8192. This is full. So we need to increase it by using array doubling technique. So new array size will be 16384. Then copy 8192 elements from old array to new array, then deallocate the old array. Now we can realize that before deallocating the ... Read More

Melding Two Max HBLTs in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:10:20
The meld strategy is done easily using recursion. Suppose A and B are two HBLTs, that will be melded. If one of them is empty, then simply make another one as final result. If no empty HBLT is there, then we have to compare the elements in the two roots. The root with larger element becomes the root of melded HBLT.Suppose A has larger root. And that is its left subtree is L. Suppose C be the max HBLT, that results from melding the right subtree of A and the HBLT B. The final HBLT will have A as root, ... Read More

Deletion of Max Element from a Max HBLT In Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:07:28
In Max HBLT, the root is placed at the root. If the root is deleted, then two max HBLTs, i.e. left and right will be separated. By melding together these two Max HBLT again, we can merge them into one. So after melding all elements will be there, except the deleted one.

Insertion Into a Max HBLT in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:06:16
The insertion into Max HBLT, can be done using Max Meld operation. This operation is used to merge two Max HBLT into one Max HBLT. Suppose, we want to insert x into one max HBLT, called H. We will create a small HBLT using x, then meld this with H, then after melding, H will hold all elements including x. So melding operation is needed to perform the insertion operations for HBLT.

Height-Biased Leftist Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:04:42
Here we will see what is the Height Balanced Leftist Trees (HBLT). Consider a binary tree where a special node, called an external node replaces each empty subtree. All other nodes are called Internal Nodes. When some external nodes are added with some binary tree, then that is called an extended binary tree.If we do not consider the leaf edges of this tree, then that is the actual binary tree. and this is the extended binary tree.Now suppose s(x) be the length of a shortest path from node x to an external node in its subtree. If x is an ... Read More
Advertisements