Quickfind algorithm implementation