1)Explain what the following code prints. Draw a picture of thelinked list after each step.
LinkedList<String> staff = new LinkedList<>();
staff.addFirst(“Harry”);
staff.addFirst(“Diana”);
staff.addFirst(“Tom”);
System.out.println(staff.removeLast());
System.out.println(staff.removeFirst());
System.out.println(staff.removeLast());
2) Explain what the following code prints. Draw a picture of thelinked list after each step.
LinkedList<String> staff = new LinkedList<>();
staff.addFirst(“Harry”);
staff.addLast(“Diana”);
staff.addFirst(“Tom”);
System.out.println(staff.removeLast());
System.out.println(staff.removeFirst());
System.out.println(staff.removeLast());
3)You are given a linked list of strings. How do you remove allelements with length less than or equal to three?
4)What advantages do linked lists have over arrays? Whatdisadvantages do they have?
5)Suppose you need to organize a collection of telephone numbersfor a company division. There are currently about 6,000 employees,and you know that the phone switch can handle at most 10,000 phonenumbers. You
PayPal Gateway not configured
PayPal Gateway not configured