Algorithm sample coding