BK Tree implementation for iOS