Added a compareTo method that organizes all the nodes in the ArrayList
by their increasing number of frequencies!