Computer Science, asked by gauravtamang9586, 11 months ago

Given an array arr and a number k where k is smaller than size of array, the task is to find the kth smallest element in the given array. It is given that all array elements are distinct.

Answers

Answered by danielshivasai
2
  • Let's see another example to get second largest number in java array using collections.
  • import java.util.*;
  • public class SecondLargestInArrayExample2{
  • public static int getSecondLargest(Integer[] a, int total){
  • List<Integer> list=Arrays.asList(a);
  • Collections.sort(list);
  • int element=list.get(total-2);
  • return element;

  • pls click brainlylist
Similar questions