Answered step by step
Verified Expert Solution
Question
1 Approved Answer
void readjustNetwork(int startIndex, int endindex); Manipulate next pointers to readjust the linked list. Here, startIndex is index of a node from starting. Similarly endindex is
void readjustNetwork(int startIndex, int endindex); Manipulate next pointers to readjust the linked list. Here, startIndex is index of a node from starting. Similarly endindex is index of a node from beginning. The function will send the chunk of the link list between start index and end index at the end of the linked list. Consider the node at head as index 0. For example, if you have linked list like this: "A -> B- C -> D -> E-> NULL", and startIndex=1 and endindex=3, then the linked list after readjustNetwork should be A -> E -> B -> C -> D-> NULL". If you have linked list like this: "A - B - C - D -> NULL", and startindex=0 and endindex=2, then the linked list after readjustNetwork should be "D-> A - B -> C -> NULL". Here, "D" is the new head. If the linked list is empty, print "Linked List is Empty". If endindex is bigger than the number of nodes in the linked list or smaller than 0, then print "Invalid end index". endIndex should be lesser than the index of the last element in the linked list. Otherwise print "Invalid end index". If startIndex is bigger than the number of nodes in the linked list or smaller than 0, then print "Invalid start index". If startIndex > endIndex print "Invalid indices". [NOTE: Change the order of the "node" (by manipulating the next pointers of each node), not the "value of the node"]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started