Question: Q 2 ( 2 0 points ) : Linked - Lists Consider the following four ( 4 ) linked - list methods ( Assume they

Q2(20 points): Linked-Lists
Consider the following four (4) linked-list methods (Assume they are implemented and ready to be used as specified below):
insert at position takes a position (int) value and a node, and it inserts the new node at that position in the list including the first and last positions. peek at position takes a position (int) value and it returns the data stored in the node at that position in the list including the first and last positions. delete from position takes a position (int) value and it deletes a node located at that position in the list including the first and last positions. list_size returns the current size of the linked-list.
Using ONLY the above 4 methods, write detailed English-like pseudocode or Java-Like code for a new linked-list method, call it move node (...), to move a node from one position to another in the same linked-list. The specification of this new method is:
METHOD move_node (int P1, int P2);
where P1 is the removal position and P2 is the insertion position.
Yous pseudocode code must be detailed, logically correct, and complete. Check for all special cases including the validation of the position values.
 Q2(20 points): Linked-Lists Consider the following four (4) linked-list methods (Assume

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!