Question: You are given a linked list that contains N integers. You have performed the following reverse operation on the list: Select all the subparts


You are given a linked list that contains N integers. You have

performed the following reverse operation on the list: Select all the subparts



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: Try to use a linked list to solve this problem. Input format: First line: N Next line: N space-separated integers that denote elements of the reverse list Output format: Print the N elements of the original list. Constraints 1SNS 103 15 Ai s 10 Sample Input: 9. 2 18 24 3 5 79 6 12 Sample Output: 24 18 2 3 5 7 9 12 6 Explanation: In the sample, the original list is (24,18,2,3,5,7,9,12,6} which when reversed according to the operations will result in the list given in the sample input.

Step by Step Solution

3.36 Rating (159 Votes )

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 Algorithms Questions!