You have a singly linked list in which the first part and the second part(not exactly split in the middle) are sorted independently. You need to return a fully sorted list merging these two parts.
For example:
Input: 1->3->5->7->2->4->6->8
Output: 1->2->3->4->5->6->7->8
Your Answer.java need to implement the following interface
public class Answer implements FullySortSLLInterface
{
@Override
public Node FullySortSLL(Node node)
{
//WRITE YOUR CODE HERE
}
}
Here is the Node.java. You don't need to upload this class.
public class Node {
public int nodeValue;
public Node nextNode;
}
Answer
Answer
No comments:
Post a Comment