Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started