Self-Teaching Algorithms