Question: Complete the isSorted method of the below LinkedList class such that it determines whether the list is sorted (ascending or descending based on the input
Complete the isSorted method of the below LinkedList class such that it determines whether the list is sorted (ascending or descending based on the input argument), i.e., it returns true if the numbers in the list are in strictly increasing order (no duplicates allowed) when ascending is true and it returns true if the numbers are in strictly decreasing order when ascending is false. The function shoud return false otherwise. (Java)
public class LinkedList private Node first if list is empty, then first m* null private class Node public int item; public Node next. public boolean issorted (boolean ascending) TODO recursive helper function private boolean issorted (Node n, boolean ascending)Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
