- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1862 Articles for Data Structure
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
358 Views
In this section we will see what is the segment tree. Before discussing that, let us see one problem.Suppose we have an array arr[0, …, n-1], We can do following operations −Find the sum of elements from index l to r, where 0 ≤ l ≤ r ≤ n-1Change the value of a specified element of the array to a new value x. We need to do arr[i] = x. The i in range 0 to n – 1.We can solve this problem by using the Segment tree. The segment tree can help us to get the sum and query ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
1K+ Views
In this section we will see what is the interval tree. As the name suggests, that the interval trees are the trees which are associated with the intervals. So before discussing about the interval trees, let us see the elementary intervals.An interval is basically a range. So if one interval is written as [a, b] it indicates that the range is starting from a, and ending at b.Now suppose there is an interval [10, 20]. So there are three range values. First one is -∞ to 10, 10 to 20 and finally 20 to ∞Now, suppose we will create second ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
649 Views
Here we will see, how to perform the deletion of a node from B+ Tree. Suppose we have a B+ Tree like below 7minus;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 is same as ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
919 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
636 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
515 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
867 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
147 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
940 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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
148 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