CSIT 254 Data Structure Lab 4 – Singly Linked ListsName 1_____________________________
4
Name 2______________________________
1. Suppose we have an ordered Linked List, as shown in the logical diagram below, and we are
adding a newElement whose value is “Mango”. Supposed we have already moved cursor and
previous as seen below.
Using only the variables previous, cursor, and newElement, write the line of code that will insert
the newElement between previous and cursor.
A. Code:
B. Modify the diagram to show how the linked list will look after the add occurs
newElement: “Mango”
CSIT 254 Data Structure Lab 4 – Singly Linked Lists – Sum 19
2. Suppose we have an ordered Linked List, as shown in the logical diagram below, and we are
removing target whose value is “cherry”. Supposed we have already moved cursor and
previous as seen below.
Using only the variables previous, cursor, and target, write the line of code that will remove the
target value from the linked list.
A. Code:
B. Modify the diagram to show how the linked list will look after the remove occurs
target: “cherry”