释义 |
DictionarySeesortbubble sort
bubble sort[′bəb·əl ‚sȯrt] (computer science) A procedure for sorting a set of items that begins by sequencing the first and second items, then the second and third, and so on, until the end of the set is reached, and then repeats this process until all items are correctly sequenced. bubble sortA sorting technique in which pairs of adjacent values in thelist to be sorted are compared and interchanged if they areout of order; thus, list entries "bubble upward" in the listuntil they bump into one with a lower sort value. Because itis not very good relative to other methods and is the onetypically stumbled on by naive and untutored programmers,hackers consider it the canonical example of a naivealgorithm. The canonical example of a really *bad* algorithmis bogo-sort. A bubble sort might be used out of ignorance,but any use of bogo-sort could issue only from brain damage orwillful perversity.bubble sortA sorting technique that is typically used for sequencing small lists. It starts by comparing the first item to the second, the second to the third and so on until it finds one item out of order. It then swaps the two items and starts over. The sort may alternate from the top of the list to the bottom and then from the bottom to the top. The name comes from the notion that items are raised or "bubbled up" to the top. See sort algorithm. |