data structure and algorithm with javascript