Question: JAVA /** * maxPosition returns the position of the maximum data in the LinkedList. * The first position in the LinkedList is 0 and the

JAVA

/** * maxPosition returns the position of the maximum data in the LinkedList. * The first position in the LinkedList is 0 and the last is size()-1. * If the list is empty you will need to return -1. * If there are duplicates, you can return any of the indices. * * Examples: * LinkedList : null ==> return -1 * LinkedList : 2 --> 3 --> null ==> return 1 * LinkedList : 6 --> 3 --> null ==> return 0 * LinkedList : 2 --> -3 --> 2 --> null ==> return 0 or 2 */

The code: public int maxPosition() { return 0; // TODO }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!