Answer to Question #4817 in Java | JSP | JSF for anthony hector
2011-10-21T09:57:59-04:00
link list in java of length,n.a number,m is given and the program needs to on the mth node remove the node and continue doing so until the last node remains.
1
2012-05-24T08:49:07-0400
import java.util.LinkedList; public class Question4817 { public static LinkedList list = new LinkedList(); public static void inputData(){ & list.add("Fisrt"); & list.add("1"); & list.add("Second"); & list.add("3"); & list.add("Four"); } public static void removeData(){ & while(!list.isEmpty()){ & System.out.println(list.peek() + " removing"); & list.poll(); & & } } public static void main(String[] args) { & // TODO Auto-generated method stub & & inputData(); & removeData(); & System.out.println("Done!"); } }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
Java JSP JSF
Comments
Leave a comment