answersLogoWhite

0

When would you use bubble sort?

Updated: 10/18/2022
User Avatar

Wiki User

8y ago

Best Answer

Never. Bubble sort is often cited as an example of how not to write a sorting algorithm and is used purely as a programming exercise. It is never used in production code.

Although reasonably efficient when sorting small lists, an insertion sort performs better on average. But for larger lists it has no practical uses. A merge sort is better for large lists, but if stability isn't an issue a quick sort is even better. Hybrid sorts typically use quick sort until a partition is small enough for an insertion sort to complete the job.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When would you use bubble sort?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you sort the given contents of an array?

You would sort the given elements of an array by a bubble sort or heap sort code!!


What is another name for bubble sort?

Bubble sort is also known as sinking sort.


Why is the Bubble Sort algorithm also referred ro as Sink Sort?

Bubble sort got its name because if you could watch the way your data was changing, on each iteration you would see the greatest number "bubble" to the top.Similarly, you could said that you would see the lowest number "sink" to the bottom.


How can you put in order a list of telephone numbers?

You could use a bubble sort.


Why is a bubble sort often presented first when learning sorting methods?

Bubble sort is often taught first because it's a really simple sort, and quite easy to comprehend. Specifically in Python you should never write your own sort, but use the sorted() builtin function.


Who invented the bubble sort?

ramesh


What are the advantages for bubble sort?

Bubble sort has no practical applications other than that it is often cited as an example of how not to write an algorithm. Insert sort is the best algorithm for sorting small lists of items and is often used in conjunction with quick sort to sort larger lists. Like insert sort, bubble sort is simple to implement and is a stable sort (equal items remain in the same order they were input). However, insert sort uses copy or move operations rather than swaps (which is actually three operations per swap) and is therefore quicker. The only time a bubble sort will work quicker than insert sort is when the array is already sorted, which renders the entire algorithm redundant. A modified algorithm that specifically tests if an array is sorted or not would be more efficient than a single-pass bubble sort.


Bubble sort Extra or in space?

Bubble sort is an "in place" algorithm. Other than a temporary "switch" variable, no extra space is required.


What is bubble sort and explain with examples?

bubbles


Can you draw a flow chart for bubble sort?

no


What are some sorting rules for math?

Binary sort and bubble sort are two.


How would you use bubble in a sentence?

you just did. the bubble landed on the sleeping dogs nose. the startled child stared in awe when the bubble formed from the end of a stick.