answersLogoWhite

0


Best Answer

The advantage of sorting is that it is quicker and easier to find things when those things are organised in some way. The disadvantage is that it takes time to sort those things. In computing terms, the cost of searching a few unsorted items is minimal, but when searching a large number of items (millions or perhaps billions of items), every search will have an unacceptable cost which can only be minimised by initially sorting those items. The cost of that sorting process is far outweighed by the speed with which we can subsequently locate items. Inserting new elements into a sorted set also incurs a cost, but no more than the cost of searching for an element, the only difference is we search for the insertion point rather than a specific element.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Bubble sort is fine when dealing with small lists, with fewer than around 20 items. Time complexity is O(n^2) but this can be reduced to O(n!) by ignoring the last item from each previous pass (since it is guaranteed to be sorted). And by keeping track of the last swap in the previous pass, the big O can be reduced even further, averaging O(n!/2). A fully-optimised bubble sort would then take linear time O(n) to process an already sorted list. Other advantages include tiny code size, stability (equal items maintain their sequence) and minimal auxiliary memory.

For more than 20 items, other methods such as quick-sort prove to be faster on average O(n log n) for anything other than an already sorted list O(n^2). For relatively small lists, the difference is insignificant, but for larger data sets, the difference soon becomes visibly evident.

Unless your list has some way to determine if the list is already-sorted in constant time (maintaining a flag every time unsorted items are inserted, for instance), a hybrid sort is worth consideration. A hybrid sort makes an initial pass using bubble-sort. If no changes are detected, then the list is already sorted, otherwise a more efficient algorithm completes the sorting process.

See related links below for a comparison of sorting algorithms.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Advantage, easy to code.

Disadvantage, it runs in Big-Theta(n2) time.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the disadvantages of bubble sort?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is another name for bubble sort?

Bubble sort is also known as sinking sort.


What are the advantages and disadvantages of bubble sensing?

advantagaes of bubble sensing


Who invented the bubble sort?

ramesh


Bubble sort Extra or in space?

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


Can you draw a flow chart for bubble sort?

no


What is bubble sort and explain with examples?

bubbles


What are some sorting rules for math?

Binary sort and bubble sort are two.


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 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.


Can you modify the bubble sort algorithm to search to sort an array of characters instead of array of integers?

The bubble sort algorithm can be applied to an array of characters. Every character can be translated to an integer equivalent via the ascii table


What are the advantages and disadvantages of selection sort?

No


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.