Add the function of finding predecessor with rank.