Can Algorithms Collaborate? The Replica Exchange Method and Its Spectral Gap