Menu

[Solved]5 Points Question 1 Advantages Linked Lists Arrays Disadvantages 10 Points Question 2 B Fo Q37156991

[5 points] Question #1 What advantages do linked lists have over arrays? What disadvantages do they have? [ 10 points] Questi

please i need help with this work

[5 points] Question #1 What advantages do linked lists have over arrays? What disadvantages do they have? [ 10 points] Question #2 A) B) What does the following code print? Draw a picture of the linked list after each line. Assume it is a doubly linked list. LinkedList<String> staff= new LinkedListくString> (); staff.addFirst (“Harry)i staff.addLast (“Diana” staff.addFirst (“Tom”) System.out.printin (staff.removeLast )) System.out.printin (staff.removeFirsto) System.out.printin (staff.removeLast 0); //Line 1 //Line 2 //Line 3 //Line 4 //Line5 //Line 6 //Line 7 tem Printout of lines 5 to 7 Linked list picture after lines 1 to 7 Points [15 points] Question #3 A) What does the following code print? B) Draw a picture of the linked list including the iterator position after each line. Assume it is a doubly linked list. LinkedList<String> staff new LinkedList<String> (); Listíterator<String>iterator= staff. I istíterator(); iterator.add (“Tom” iterator.add (“Diana”) iterator.add (“Harry”) iteratorstaff.listiterator if (iterator.next () equals (“Tom”)) //Line 1 //Line 2 //Line 3 //Line 4 //Line 5 //Line 6 //Line7 System.out.println(“Yes”)) //Line 8 System.out println (iterator.next) Points 1.5 1.5 tem Printout of line 7 Printout of line 8 Linked list picture and iterator position after lines 1 to 8 8 x 1.5 Show transcribed image text [5 points] Question #1 What advantages do linked lists have over arrays? What disadvantages do they have? [ 10 points] Question #2 A) B) What does the following code print? Draw a picture of the linked list after each line. Assume it is a doubly linked list. LinkedList staff= new LinkedListくString> (); staff.addFirst (“Harry)i staff.addLast (“Diana” staff.addFirst (“Tom”) System.out.printin (staff.removeLast )) System.out.printin (staff.removeFirsto) System.out.printin (staff.removeLast 0); //Line 1 //Line 2 //Line 3 //Line 4 //Line5 //Line 6 //Line 7 tem Printout of lines 5 to 7 Linked list picture after lines 1 to 7 Points [15 points] Question #3 A) What does the following code print? B) Draw a picture of the linked list including the iterator position after each line. Assume it is a doubly linked list. LinkedList staff new LinkedList (); Listíteratoriterator= staff. I istíterator(); iterator.add (“Tom” iterator.add (“Diana”) iterator.add (“Harry”) iteratorstaff.listiterator if (iterator.next () equals (“Tom”)) //Line 1 //Line 2 //Line 3 //Line 4 //Line 5 //Line 6 //Line7 System.out.println(“Yes”)) //Line 8 System.out println (iterator.next) Points 1.5 1.5 tem Printout of line 7 Printout of line 8 Linked list picture and iterator position after lines 1 to 8 8 x 1.5

Expert Answer


Answer to [5 points] Question #1 What advantages do linked lists have over arrays? What disadvantages do they have? [ 10 points] Q… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *