3 ms·
The logic of bubble sort is so simple that just the description is enough for an implementation. It's a common interview question for the same reason Fizzbuzz i
by cinnamonheart 7y ago
The logic of bubble sort is so simple that just the description is enough for an implementation. It's a common interview question for the same reason Fizzbuzz is used -- any programmer worth their salt should be able to just write it down.
Insertion and selection sort are also O(N^2), but sorts like merge and quick will use them to sort small sublists in their recursive cases because they are fast when input is small enough.
- Gunax 7y agoI see. I would hope one would give a description of what bubble sort is during the question. It's definitely easy to implement, it just had me worried because I had never heard of it!