## Auto-complete feature using Trie

Updated on 21-Sep-2020 13:19:12
We have a Trie, and when a user enters a character, we have to show the matching string the Trie. This feature we call it as auto-completion. For example, if a Trie contains "xyzzzz, ""xyz, " "xxxyyxzzz" and when the user enter xy, then we have to show them xyzzzz, xyz, etc.., Steps to achieve the result.Search for the string using the standard Trie algorithm.If the string is not present, then return -1.If the string is present and is the end of a word in Trie, then print the string.If the matching string doesn't have any node, then return.Else print ... Read More

## Segment Trees in Data Structure

Updated on 11-Aug-2020 07:52:15
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

## Interval Trees in Data Structure

Updated on 11-Aug-2020 07:50:46
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

## B+ tree Deletion in Data Structure

Updated on 11-Aug-2020 07:47:36
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

## B+ tree Insertion in Data Structure

Updated on 11-Aug-2020 07:42:05
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 B-Tree, if one element is inserted, that will be stored at the leaf node. If that is present in some internal node, then it will also be there, at the leaf as right child of itself.Suppose we want to insert 65 into the tree. So that is greater than 60, and less than 75. Then it will be inserted into the middle sub-tree. Now, ... Read More

## B+ tree Query in Data Structure

Updated on 11-Aug-2020 07:35:34
Here we will see, how to perform the searching in B+ Tree. The B+ Tree searching is also known as B+ Tree Querying. This algorithm is very much similar to the querying of B-Tree. Moreover, this supports range query. 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 63 from the above tree. So we will start from root, now 63 is larger than root element 60 but smaller than 75. So we will move to the right child of the ... Read More

## The B+ tree in Data Structure

Updated on 11-Aug-2020 07:33:12
Here we will see what are the B+ Trees. The B+ Trees are extended version of B-Trees. This tree supports better insertion, deletion and searching over B-Tree.B-trees, the keys and the record values are stored in the internal as well as leaf nodes. In B+ tree records, can be stored at the leaf node, internal nodes will store the key values only. The leaf nodes of the B+ trees are also linked like linked listExample of B+ Tree −This supports basic operations like searching, insertion, deletion. In each node, the item will be sorted. The element at position i has ... Read More

## B-tree Deletion in Data Structure

Updated on 11-Aug-2020 07:31:37
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

Updated on 11-Aug-2020 07:25:53
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

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
Advertisements