Question: Complete the method isSorted that * takes in as input an array of String and returns back a boolean value whether it is sorted in
Complete the method isSorted that * takes in as input an array of String and returns back a boolean value whether it is sorted in Lexicographical order or not. * You can read up more on this here: https://en.wikipedia.org/wiki/Lexicographical_order public class Sorting { public static boolean isSorted(String[] array) { } /* *Don't modify any main code */ public static void main(String[] args) { String[] items={"a","b","c"}; System.out.println(Sorting.isSorted(items)); //must print true String[] items1={"c","a","b"}; System.out.println(Sorting.isSorted(items1)); //must print false String[] items2={"111","112","131","132"}; System.out.println(Sorting.isSorted(items2)); //must print true String[] items3={"a","aa","b","bb","c","ca"}; System.out.println(Sorting.isSorted(items3)); //must print true String[] items4={"z","zz","zzz","zzzz"}; System.out.println(Sorting.isSorted(items4)); //must print true } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
