Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*************************************JAVA*********************************** 1) write a static method called betweenOccurence in IntNode . The method has three parameters. The first parameter is a head reference for a

*************************************JAVA***********************************

1) write a static method called betweenOccurence in IntNode. The method has three parameters. The first parameter is a head reference for a linked list of integers, and the next two parameters are integer x and y. The method should write a line to System.out containing all integers in the list that are between the first occurrence of x and the first occurrence of y.

2) write a static method called reverse in IntNode. The method has one parameter that is a head reference for a linked list of integers. The method creates a new list that has the same element as the original list but in the reverse order. The method returns a head reference for the new list.

3) write a static method called orderedUnion in IntNode. The method has two linked list head references as parameters. Assume that linked lists contain integer data, and on each list, every element is less than the next element on the same list. The method should create a new linked list that contains all the elements on both lists, and the new linked list should also be ordered (so that every element is less than the next element in the list). The new linked list should not eliminate duplicate elements (i.e., if the same element appears in both input list, then two copies are placed in the newly construct linked list). The method should return a head reference for the newly constructed linked list.

4) write a static method called split in IntNode. The method starts with a single linked list of integers and a special value called the splitting value. The elements of the list are in no particular order. The method divides the nodes into two linked lists: one containing all the nodes that contain an element less than the splitting value and one that contains all the other nodes. If the original linked list has any repeated integers (i.e., any two or more nodes with the same element in them), then the new linked list that has this element should have the same number of nodes that repeat element. It does not matter whether you preserve the original linked list or destroy it in the process of building the two new lists, but your comments should document what happens to the original linked list. The method returns two head references- one for each of the linked lists that were created.

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

Step: 3

blur-text-image

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago