Answered step by step
Verified Expert Solution
Link Copied!

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!!!
image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

A brief history and development of hospitality business

Answered: 1 week ago