Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code this in java!!! import java. util.List; public class LinkedList { private ListNode head, tail; private int size; private int mergedArray[]; public LinkedList() {
Please code this in java!!!
import java. util.List; public class LinkedList { private ListNode head, tail; private int size; private int mergedArray[]; public LinkedList() { head size = tail = null; public void mergesort() { = new int[size()]; mergedArray mergesort(0, size() 1, head, tail); private void mergesort(int left, int right, complete this function public ListNode insertAtFront(int value) { = new ListNode(va1ue); ListNode newNode if (size == 0) { = tail head = newNode; } else { newNode.next = head; head = newNode; size++, return newNode; public ListNode insertAtEnd(int value) { ListNode newNode = new ListNode(va1ue); if (size == 0) { = tail head = newNode; } else { tail. next = newNode; tail = newNode; size++, return newNode; public void printList() { if (size == 0) System. out . print In ( " C] " ) ; else { ListNode tmp = head; String output for (int i = 0; i < size output += tmp.value + tmp = tmp.next; output += tail. value + ; System. out . print In (output); public int size() { return size; ListNode leftNode, ListNode rightNode)
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