Computer Science, asked by jhitesh1999, 5 months ago

The function/method reverseLinkedList accepts one argument - list representing the head
of a singly linked list and is supposed to reverse the second half of the linked list.
For example, if the list is 2-3 3-3 6-1 -> 4 -> 8 -> 9 -> 7
then the resulting list would be 2 -> 3 -> 6 - 1 - 7 -> 9 -> 9 -> 4
The function/method compiles successfully but fails to return the desired output due to
incorrect implementation of the linked lists. Your task is to fix the code so that it passes all th
test cases.
Note
If the number of elements in the list (N) is odd, then the second half of the ist begins at
N)
position (N+1)/2.
if the number of elements in the list (N) is even, then the second half of the list begins at
position (N/2)+1.
Helper Description
The following class is used to representa node of the linked list and is already implemented in
the default code (Do not write this definition again in your code):
Class LNode
int value;
LNode next;​

Answers

Answered by Aman91100
0

Answer:

second half of the ist begins at

N)

position (N+1)/2.

if the number of elements in the list (N) is even, then the second half of the list begins at

position (N/2)+1.

Helper Description

The following class is used to representa node of the linked list and is already implemented in

the default code (Do not write this definition again in your code):

Class LNode

int value;

LNode next; sorry

Similar questions