added Comparator for algorithm sorting