Second largest element in an array Java program #codingguru #youtubeshorts😎

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

he is using bubble sort alogothm to find element and then swapping them after then printing 2nd largest element of sorted array

divbytes
Автор

What if the largest element occured two times?

naseeraj
Автор

Total fake just he wrote the a[1] at print statement in which the the 12 is there at index 1 so, it's printed. It's not the procedure infact he just printed the direct value.

timepassforyou
Автор

Your code useless when array doesn't contain unique numbers

Remove duplicates by hashset and use sort method and return the second it will works

cherukucreation