Question: PLEASE DON'T CREATE ANY NEW NODES OR LIST OBJECTS . The problem specifically tells that. Implement a generic method that, given the head node of

 PLEASE DON'T CREATE ANY NEW NODES OR LIST OBJECTS. The problem

PLEASE DON'T CREATE ANY NEW NODES OR LIST OBJECTS. The problem specifically tells that.

Implement a generic method that, given the head node of a singly linked list L, splits it into two singly linked lists Lodd and Leven and returns the head nodes of Lodd and Leven in a length-2 array. All the elements at odd positions in the original list need to go into Lodd and, similarly, all the elements at even positions in the original list need to go into Leven. Your method may traverse the original list only once. You are not allowed to create any nodes or list objects. While we refer to lists L,Lodd and Leven here, the method should not use any list objects; only node sequences

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!