steps in sketch algorithm