ad algorithm pdf file