my practice code to general algorithms