head OB-OD-ME-D/ DH М K P FIGURE 5-32 1. For each of the following, write the Java statements that perform the requested operation on the list shown in Figure 5-32. Also draw a picture of the status of the list after each operation is complete. When you delete a node from the list, make sure it will eventually be returned to the system. All insertions into the list should maintain the list's sorted order. Do not use any of the methods that were presented in this chapter. a. Assume that prev references the first node and curr references the second node. Insert L into the list. b. Assume that prev references the second node and that curr references the third node of the list after you revised it in Part a. Delete the last node of the list. c. Assume that prev references the last node of the list after you revised it in Part b, and assume that curr is null. Insert Q into the list.

icon
Related questions
Question
head
KD-MO-DZ
30
P
10
FIGURE 5-32
1. For each of the following, write the Java statements that perform the requested
operation on the list shown in Figure 5-32. Also draw a picture of the status of the
list after each operation is complete. When you delete a node from the list, make
sure it will eventually be returned to the system. All insertions into the list should
maintain the list's sorted order. Do not use any of the methods that were presented
in this chapter.
a. Assume that prev references the first node and curr references the second
node. Insert L into the list.
b. Assume that prev references the second node and that curr references the third
node of the list after you revised it in Part a. Delete the last node of the list.
c. Assume that prev references the last node of the list after you revised it in Part
b, and assume that curr is null. Insert Q into the list.
Transcribed Image Text:head KD-MO-DZ 30 P 10 FIGURE 5-32 1. For each of the following, write the Java statements that perform the requested operation on the list shown in Figure 5-32. Also draw a picture of the status of the list after each operation is complete. When you delete a node from the list, make sure it will eventually be returned to the system. All insertions into the list should maintain the list's sorted order. Do not use any of the methods that were presented in this chapter. a. Assume that prev references the first node and curr references the second node. Insert L into the list. b. Assume that prev references the second node and that curr references the third node of the list after you revised it in Part a. Delete the last node of the list. c. Assume that prev references the last node of the list after you revised it in Part b, and assume that curr is null. Insert Q into the list.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer