Consider the definition of the add method that adds an entry to a list at a given position and appears in Segment 14.11. Replace the statements that execute in case 1 with the following ones:
if (isEmpty() || (newPosition == 1)) // case 1{ firstNode = newNode; newNode.next = firstNode;}a. What is displayed by the following statements in a client of the modified LList?
ListInterfacemyList = new LList ();myList.add(1, "30");myList.add(2, "40");myList.add(3, "50");myList.add(1, "10");myList.add(5, "60");myList.add(2, "20");int numberOfEntries = myList.getLength();for (int position = 1; position <= numberOfEntries; position++)System.out.print(myList.getEntry(position) + " "); b. What methods, if any, in LList could be affected by the change to the method add when they execute? Why?
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.