codes when I learn algorithms, write with nodejs