self algorithm practice