Like Red-Black and AVL Trees, Treap is a Balanced Binary Search Tree, but not guaranteed to have height as O(Log n). The idea is to… Read More »
Given an array of words, find all shortest unique prefixes to represent each word in the given array. Assume that no word is prefix of… Read More »
Heaps are mainly used for implementing priority queue. We have discussed below heaps in previous posts. Binary Heap Binomial Heap In terms of Time Complexity,… Read More »
We strongly recommend to refer below posts as a prerequisite of this. K Dimensional Tree | Set 1 (Search and Insert) K Dimensional Tree |… Read More »
We strongly recommend to refer below post as a prerequisite of this. K Dimensional Tree | Set 1 (Search and Insert) In this post find… Read More »
Segment tree is introduced in previous post with an example of range sum problem. We have used the same “Sum of given Range” problem to… Read More »
How to design a system that takes big URLs like “http://www.geeksforgeeks.org/count-sum-of-digits-in-numbers-from-1-to-n/” and converts them into a short 6 character URL.
Design a data structure that supports following operations in Θ(1) time. insert(x): Inserts an item x to the data structure if not already present. remove(x):… Read More »
Unlike C++ and Java, C doesn’t support generics. How to create a linked list in C that can be used for any data type? In… Read More »
Given a string, find the longest substring which is palindrome. We have already discussed Naïve [O(n3)], quadratic [O(n2)] and linear [O(n)] approaches in Set 1,… Read More »
We have discussed implementation of Reverse DNS Look Up Cache. Forward DNS look up is getting IP address for a given domain name typed in… Read More »
Let us consider the following problem to understand Binary Indexed Tree.
Reverse DNS look up is using an internet IP address to find a domain name. For example, if you type 184.108.40.206 in browser, it automatically… Read More »
Given two strings X and Y, find the Longest Common Substring of X and Y. Naive [O(N*M2)] and Dynamic Programming [O(N*M)] approaches are already discussed… Read More »
In earlier suffix tree articles, we created suffix tree for one string and then we queried that tree for substring check, searching all patterns, longest… Read More »