Found 210 Articles for Analysis of Algorithms

B-tree Deletion in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:31:37

915 Views

Here we will see, how to perform the deletion of a node from B-Tree. Suppose we have a BTree like below −Example of B-Tree −Deletion has two parts. At first we have to find the element. That strategy is like the querying. Now for deletion, we have to care about some rules. One node must have at-least m/2 elements. So if we delete, one element, and it has less than m-1 elements remaining, then it will adjust itself. If the entire node is deleted, then its children will be merged, and if their size issame as m, then split them ... Read More

B-tree Insertion in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:25:53

625 Views

Here we will see, how to perform the insertion into a B-Tree. Suppose we have a B-Tree like below −Example of B-Tree −To insert an element, the idea is very similar to the BST, but we have to follow some rules. Each node has m children, and m-1 elements. If we insert an element into one node, there are two situations. If the node has elements less than m-1, then the new element will be inserted directly into the node. If it has m-1 elements, then by taking all elements, and the element which will be inserted, then take the ... Read More

B-tree Query in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 07:27:13

506 Views

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

864 Views

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

144 Views

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

934 Views

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

147 Views

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

450 Views

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

194 Views

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

104 Views

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.

Advertisements