We present a new algorithm to rapidly compute the two-point (2PCF), three-point (3PCF) and n-point (n-PCF) correlation functions in roughly O(N) time for N particles, instead of O(Nn) as required by brute force approaches. This technique exploits node-to-node correlations of a recursive bisectional binary tree. A balanced tree construction minimizes the depth of the tree and the worst case erro...