Question: please solve the 2 of them using java Problem Msert a node at a specific position in a linked list. Write a method that inserts

please solve the 2 of them using java please solve the 2 of them using java Problem Msert a node

Problem Msert a node at a specific position in a linked list. Write a method that inserts a node at a specific position of the singly linked list. A position of o indicates head, a position of 1 indicates one node away from the head and so on. The head node may be null meaning that the initial list is empty. As an example, if your list starts as 1 -> 2 - > 3 and you want to insert a node at position 2 with element = 4, your new list should be 1->2->4->3 Public void insertAtPos( E e, int position) Problem 2: Write a method called printList() and add it to class Singly LinkedList. This method is used to output the elements of the linked list. Then write a main program to create a linked list and test the printList method above (sample output is shown below) Output - SL Problem1 (run) Calling syList.addrizst (10) Calling myList.addlast (20) Calling my ist.addFirss (30) Printing list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!