Used java.util.LinkedList to generate results
Updated