Google Interview - BubbleSort Algorithm with Java Implementation

preview_player
Показать описание
Implement the BubbleSort algorithm and explain why it is not an efficient algorithm.

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

The issue is that the outer loop does not affect the inner loop. And the value of i was not getting smaller. The "for loop" would be

For( i = a.length; i > 0, i --)
For( j =0; j < i-1; j ++)

alexnice
Автор

If in a 45 mins google interview the interviewer just asked a single question, implement bubble sort. You solve it 5 minutes before end time with some trial and errors and then dry running the coding and achieving the functionality. What are chances of being selected.

fatimasajjad
welcome to shbcf.ru