You are given a linked list that contains N integers. You have performed the following reverse operation on the list: • Select all the subparts of the list that contain only even integers. For example, if the list is {1,2,8,9,12,16}, then the selected subparts will be {2,8}, {12,16}. • Reverse the selected subpart such as {8,2} and {16,12}. Now, you are required to retrieve the original list. Note: You should use the following definition of the linked list for this problem: class Node { data next }
You are given a linked list that contains N integers. You have performed the following reverse operation on the list:
• Select all the subparts of the list that contain only even integers. For example, if the list is {1,2,8,9,12,16}, then the selected subparts will be {2,8}, {12,16}.
• Reverse the selected subpart such as {8,2} and {16,12}.
Now, you are required to retrieve the original list.
Note: You should use the following definition of the linked list for this problem:
class Node {
data
next
}You are given a linked list that contains N integers. You have performed the following reverse operation on the list:
• Select all the subparts of the list that contain only even integers. For example, if the list is {1,2,8,9,12,16}, then the selected subparts will be {2,8}, {12,16}.
• Reverse the selected subpart such as {8,2} and {16,12}.
Now, you are required to retrieve the original list.
Note: You should use the following definition of the linked list for this problem:
class Node {
data
next
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images