Question: a) [90 marks] Write a program that Splits a list into two halves. The function split() must modify the original list and return a

a) [90 marks] Write a program that Splits a list into two

a) [90 marks] Write a program that Splits a list into two halves. The function split() must modify the original list and return a pointer to the second half of the list, e.g., L=1234 must be 1 2 after execution, and the function must return 3 4. . o If the size of the original list is odd, add a node with value 99 to the index 4 (recall that the first node is at index 1 and the dummy/zeroth node is at index 0) so that the list is even-sized now. If there is no index 4, add 99 to the tail. Merges two lists such that list2 begins right after list1. b) [10 marks] State the worst-case time-complexities of both two parts above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a python class Node def initself value0 nextNone selfvalue value selfnext next def splithead slow he... View full answer

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