Sears interview question

Write a java program to find second largest element of an array (without sort method)

Interview Answer

Anonymous

22 Jun 2016

int a[]={2,3,5,6,7,8,1,5,9,33,99}; int a1=a[0]; int b1=0; for(int i=1;ia1){ b1=a1; a1=a[i]; } } System.out.println(a1+"::"+b1);