algorithm practice code