May 022017
 

Given an array of numbers find the maximum XOR value of two numbers in the array.

Input Array = {12, 15, 5, 1, 7, 9, 8, 6, 10, 13};
Output = 15 (XOR of 5 and 10)

  5 = 0101
 10 = 1010
 ---------
XOR = 1111

Continue reading »

May 012017
 

String matching is a big research area and there are many data structure (eg. B-Tree, HashMap, Set) that help indexing of strings. There are also many algorithms used for string matching (like KMP, etc.)

The major application of Trie data structure is in storing a dictionary (Collection of strings) such the searching for a word in dictionary become O(k) time operation where k is the number of characters in the word. Continue reading »