Interview Bootcamp
Ask Author
Back to course home

0% completed

Vote For New Content
For python version, why are we assigning `current` to `last_node_of_sub_list.n...

Azimul Haque

Feb 21, 2023

For python version, why are we assigning current to last_node_of_sub_list.next in the end? This is a bit confusing. I understand last_node_of_sub_list is last part. Should we need to attach it at end?

And why are we returning head? Aren't we doing all calculations in the last_node_of_sub_list, 'last_node_of_first_part', current, and previous? How will the head get updated by itself?

0

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

Can you clarify on " I understand last_node_of_sub_list is last part"?

There is only one part or a sublist from position p and q.

=> last_node_of_sub_list.next = current

The above statement ensures that we have connected the sublist with the remaining elements at t...