code was added for sample() method along with add,remove,get etc methods for LinkedList