Binary Trie
- Introduction
-
Setting
Given an array , find the maximum XOR of two numbers from array . -
Brute-force Solution
A trivial brute-force approach is : iterate over each pair of numbers and take the maximum XOR among all pairs. -
Idea
A binary trie stores all the numbers in a trie data structure. For each number, we can find the maximum XOR against all other numbers in in time, where is the number of bits. This reduces the overall complexity to .
-

