Routing algorithm for a hypercube topology