Counting Sort 1

  • + 0 comments

    Java

    public static List countingSort(List arr) { // Write your code here List the100 = new ArrayList<>();

    int init = 0;

    while(init<100){

    the100.add(0);
    
    init++;
    

    }

    for(Integer val: arr){

    int temp = the100.get(val);
    
    temp++;
    
    the100.set(val,temp);
    

    }

    return the100; }

    }