Menu
Question Index
...

Write a program to find the whether the given integer list is sorted ascending order or not.

Input(Integer List) Output
[10, 34, 23, 78, 56, 89] false
[10, 23, 34, 56, 78, 89] true
[-10, -23, -34, -56, -78, -89] true
[-89, -75, -65, -56, -43, -11] false
[] {EMPTY LIST} false
null {NULL LIST} false


import java.util.*;

class SortTheGivenIntegerListInAscendingOrder
{
    public static void main(String s[])
    {
        ArrayList<Integer> integerList = new ArrayList<Integer>();
        integerList.add(10);
        integerList.add(34);
        integerList.add(23);
        integerList.add(78);
        integerList.add(56);
        integerList.add(89);
        boolean result = isSortedInAscendingOrder(integerList);
        System.out.println("The input list "+integerList+" is sorted "+result);

    }


        public static boolean isSortedInAscendingOrder(List<Integer> inputList)
        {
            boolean result = false;
            return result;
        }

}

Doubts

Problems

Topic: Java Comparators

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App