Quick Find algorithm