can somebody tell me what can be the application of bubble sorting.or what actually application of bubble sorting means is it the usage of bubble sort in different areas.please give me some applications of it..

Votes + Comments
keep it organised please - why ask a programming question in the community intros forum?
5 Years
Discussion Span
Last Post by ayeshashahid

The only application for bubble sort is in the classroom. It's a simple algorithm, arguably the simplest sorting algorithm, and well suited as an introduction to the concept. However, it's hideously inefficient even compared to other quadratic sorting algorithms.


Since bubble sort is efficient

I think you meant to type "inefficient". I also like to add the adverb "woefully" since it drives the point home. ;)

you may want to look into some optimizations of bubble sort; there may serve better purpose

Polish a turd and it's still a turd.

Example : Bidirectional bubble sort http://en.wikipedia.org/wiki/Cocktail_sort

Funny you should bring that up, because it has a suitable quote from Knuth:

But none of these refinements leads to an algorithm better than straight insertion [that is, insertion sort]; and we already know that straight insertion isn't suitable for large N. [...] In short, the bubble sort seems to have nothing to recommend it, except a catchy name and the fact that it leads to some interesting theoretical problems.

Edited by Narue: n/a


Insertion sort is also inefficient generally but it still have its own uses :)

I don't think you understand the point that's being made. If you're going to use a quadratic sorting algorithm (bubble sort, insertion sort, selection sort, etc...), bubble sort is the worst choice by a significant margin.


>>Polish a turd and it's still a turd.

But its a cleaner turd? Anyways, who wants to touch a turd anyways, grosss lol.

As per the application of bubble-sort, the only place I seen it was in my introductory course. But even then I don't know if that is really a good idea. The one time I would show bubble sort is to demonstrate how not to write algorithms, or use it as a leeway to implement a better one.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.