codes when I learn some algorithm