Dynamic connectivity algorithms for Monte Carlo simulations of the random-cluster model