<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=5.71.118.66</id>
	<title>formulasearchengine - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=5.71.118.66"/>
	<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/wiki/Special:Contributions/5.71.118.66"/>
	<updated>2026-08-27T12:48:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.47.0-wmf.7</generator>
	<entry>
		<id>https://en.formulasearchengine.com/w/index.php?title=Credit_valuation_adjustment&amp;diff=25183</id>
		<title>Credit valuation adjustment</title>
		<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/w/index.php?title=Credit_valuation_adjustment&amp;diff=25183"/>
		<updated>2013-10-17T16:24:50Z</updated>

		<summary type="html">&lt;p&gt;5.71.118.66: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Algorithm&lt;br /&gt;
|class=[[Sorting algorithm]]&lt;br /&gt;
|image=[[File:Bubblesort-edited.png|Static visualization of bubblesort]]&lt;br /&gt;
|data=[[Array data structure|Array]]&lt;br /&gt;
|best-time= &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
|average-time= &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
|time=&amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
|space=&amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; auxiliary&lt;br /&gt;
|optimal=No&lt;br /&gt;
}}&lt;br /&gt;
&#039;&#039;&#039;Bubble sort&#039;&#039;&#039;, sometimes incorrectly referred to as &#039;&#039;&#039;sinking sort&#039;&#039;&#039;, is a simple [[sorting algorithm]] that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and [[Swap (computer science)|swap]]ping them if they are in the wrong order.  The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements &amp;quot;bubble&amp;quot; to the top of the list. Because it only uses comparisons to operate on elements, it is a [[comparison sort]]. Although the algorithm is simple, most of the other sorting algorithms are more efficient for large lists.&lt;br /&gt;
==Analysis==&lt;br /&gt;
[[File:Bubble-sort-example-300px.gif|300px|thumb|right|An example of bubble sort. Starting from the beginning of the list, compare every adjacent pair, swap their position if they are not in the right order (the latter one is smaller than the former one). After each iteration, one less element (the last one) is needed to be compared until there are no more elements left to be compared.]]&lt;br /&gt;
&lt;br /&gt;
=== Performance ===&lt;br /&gt;
Bubble sort has worst-case and average complexity both &#039;&#039;[[big o notation|О]]&#039;&#039;(&#039;&#039;n&#039;&#039;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;), where &#039;&#039;n&#039;&#039; is the number of items being sorted. There exist many sorting algorithms with substantially better worst-case or average complexity of &#039;&#039;O&#039;&#039;(&#039;&#039;n&#039;&#039;&amp;amp;nbsp;log&amp;amp;nbsp;&#039;&#039;n&#039;&#039;). Even other &#039;&#039;О&#039;&#039;(&#039;&#039;n&#039;&#039;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;) sorting algorithms, such as [[insertion sort]], tend to have better performance than bubble sort. Therefore, bubble sort is not a practical sorting algorithm when &#039;&#039;n&#039;&#039; is large.&lt;br /&gt;
&lt;br /&gt;
The only significant advantage that bubble sort has over most other implementations, even [[quicksort]], but not [[insertion sort]], is that the ability to detect that the list is sorted is efficiently built into the algorithm. Performance of bubble sort over an already-sorted list (best-case) is &#039;&#039;O&#039;&#039;(&#039;&#039;n&#039;&#039;). By contrast, most other algorithms, even those with better [[average-case complexity]], perform their entire sorting process on the set and thus are more complex. However, not only does [[insertion sort]] have this mechanism too, but it also performs better on a list that is substantially sorted (having a small number of [[inversion (discrete mathematics)|inversions]]).&lt;br /&gt;
&lt;br /&gt;
Bubble sort should be avoided in case of large collections. It will not be efficient in case of reverse ordered collection.&lt;br /&gt;
&lt;br /&gt;
===Rabbits and turtles===&lt;br /&gt;
The positions of the elements in bubble sort will play a large part in determining its performance. Large elements at the beginning of the list do not pose a problem, as they are quickly swapped. Small elements towards the end, however, move to the beginning extremely slowly. This has led to these types of elements being named rabbits and turtles, respectively.&lt;br /&gt;
&lt;br /&gt;
Various efforts have been made to eliminate turtles to improve upon the speed of bubble sort. [[Cocktail sort]] is a bi-directional bubble sort that goes from beginning to end, and then reverses itself, going end to beginning. It can move turtles fairly well, but it  retains &#039;&#039;[[Big O notation|O(n&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)]]&#039;&#039; worst-case complexity. [[Comb sort]] compares elements separated by large gaps, and can move turtles extremely quickly before proceeding to smaller and smaller gaps to smooth out the list. Its average speed is comparable to faster algorithms like [[quicksort]].&lt;br /&gt;
&lt;br /&gt;
===Step-by-step example ===&lt;br /&gt;
&lt;br /&gt;
Let us take the array of numbers &amp;quot;5 1 4 2 8&amp;quot;, and sort the array from lowest number to greatest number using bubble sort. In each step, elements written in &#039;&#039;&#039;bold&#039;&#039;&#039; are being compared.&lt;br /&gt;
Three passes will be required.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;First Pass:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
( &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;1&#039;&#039;&#039; 4 2 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( &#039;&#039;&#039;1&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 &amp;gt; 1.&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 2 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 2 8 ), Swap since 5 &amp;gt; 4 &amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 4 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;2&#039;&#039;&#039; 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 4 &#039;&#039;&#039;2&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 8 ), Swap since 5 &amp;gt; 2 &amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 4 2 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 4 2 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; ), Now, since these elements are already in order (8 &amp;gt; 5), algorithm does not swap them.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Second Pass:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
( &#039;&#039;&#039;1&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 2 5 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( &#039;&#039;&#039;1&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 2 5 8 )&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;2&#039;&#039;&#039; 5 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 &#039;&#039;&#039;2&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 5 8 ), Swap since 4 &amp;gt; 2 &amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 2 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 2 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 8 )&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 2 4 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 2 4 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; )&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs one &#039;&#039;&#039;whole&#039;&#039;&#039; pass without &#039;&#039;&#039;any&#039;&#039;&#039; swap to know it is sorted.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Third Pass:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
( &#039;&#039;&#039;1&#039;&#039;&#039; &#039;&#039;&#039;2&#039;&#039;&#039; 4 5 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( &#039;&#039;&#039;1&#039;&#039;&#039; &#039;&#039;&#039;2&#039;&#039;&#039; 4 5 8 )&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 &#039;&#039;&#039;2&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 5 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 &#039;&#039;&#039;2&#039;&#039;&#039; &#039;&#039;&#039;4&#039;&#039;&#039; 5 8 )&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 2 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 8 ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 2 &#039;&#039;&#039;4&#039;&#039;&#039; &#039;&#039;&#039;5&#039;&#039;&#039; 8 )&amp;lt;br /&amp;gt;&lt;br /&gt;
( 1 2 4 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; ) &amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt; ( 1 2 4 &#039;&#039;&#039;5&#039;&#039;&#039; &#039;&#039;&#039;8&#039;&#039;&#039; )&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Pseudocode implementation ===&lt;br /&gt;
The algorithm can be expressed as (0-based array):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pli&amp;quot;&amp;gt;&lt;br /&gt;
procedure bubbleSort( A : list of sortable items )&lt;br /&gt;
   repeat     &lt;br /&gt;
     swapped = false&lt;br /&gt;
     for i = 1 to length(A) - 1 inclusive do:&lt;br /&gt;
       /* if this pair is out of order */&lt;br /&gt;
       if A[i-1] &amp;gt; A[i] then&lt;br /&gt;
         /* swap them and remember something changed */&lt;br /&gt;
         swap( A[i-1], A[i] )&lt;br /&gt;
         swapped = true&lt;br /&gt;
       end if&lt;br /&gt;
     end for&lt;br /&gt;
   until not swapped&lt;br /&gt;
end procedure&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Optimizing bubble sort ===&lt;br /&gt;
The bubble sort algorithm can be easily optimized by observing that the n-th pass finds the n-th largest element and puts it into its final place.  So, the inner loop can avoid looking at the last n-1 items when running for the n-th time:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pli&amp;quot;&amp;gt;&lt;br /&gt;
procedure bubbleSort( A : list of sortable items )&lt;br /&gt;
    n = length(A)&lt;br /&gt;
    repeat&lt;br /&gt;
       swapped = false&lt;br /&gt;
       for i = 1 to n-1 inclusive do&lt;br /&gt;
          if A[i-1] &amp;gt; A[i] then&lt;br /&gt;
             swap(A[i-1], A[i])&lt;br /&gt;
             swapped = true&lt;br /&gt;
          end if&lt;br /&gt;
       end for&lt;br /&gt;
       n = n - 1&lt;br /&gt;
    until not swapped&lt;br /&gt;
end procedure&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More generally, it can happen that more than one element is placed in their final position on a single pass. In particular, after every pass, all elements after the last swap are sorted, and do not need to be checked again. This allows us to skip over a lot of the elements, resulting in about a worst case 50% improvement in comparison count (though no improvement in swap counts), and adds very little complexity because the new code subsumes the &amp;quot;swapped&amp;quot; variable:&lt;br /&gt;
&lt;br /&gt;
To accomplish this in [[pseudocode]] we write the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pli&amp;quot;&amp;gt;&lt;br /&gt;
procedure bubbleSort( A : list of sortable items )&lt;br /&gt;
    n = length(A)&lt;br /&gt;
    repeat&lt;br /&gt;
       newn = 0&lt;br /&gt;
       for i = 1 to n-1 inclusive do&lt;br /&gt;
          if A[i-1] &amp;gt; A[i] then&lt;br /&gt;
             swap(A[i-1], A[i])&lt;br /&gt;
             newn = i&lt;br /&gt;
          end if&lt;br /&gt;
       end for&lt;br /&gt;
       n = newn&lt;br /&gt;
    until n = 0&lt;br /&gt;
end procedure&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternate modifications, such as the [[cocktail shaker sort]] attempt to improve on the bubble sort performance while keeping the same idea of repeatedly comparing and swapping adjacent items.&lt;br /&gt;
&lt;br /&gt;
==In practice==&lt;br /&gt;
[[File:Bubble sort animation.gif|thumb|right|280px|A bubble sort, a sorting algorithm that continuously steps through a list, [[Swap (computer science)|swapping]] items until they appear in the correct order.  The list was plotted in a Cartesian coordinate system, with each point (x,y) indicating that the value y is stored at index x.  Then the list would be sorted by Bubble sort according to every pixel&#039;s value. Note that the largest end gets sorted first, with smaller elements taking longer to move to their correct positions.]]&lt;br /&gt;
Although bubble sort is one of the simplest sorting algorithms to understand and implement, its &#039;&#039;[[Big O notation|O(n&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)]]&#039;&#039; complexity means that its efficiency decreases dramatically on lists of more than a small number of elements.  Even among simple &#039;&#039;O(n&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)&#039;&#039; sorting algorithms, algorithms like [[insertion sort]] are usually considerably more efficient.&lt;br /&gt;
&lt;br /&gt;
Due to its simplicity, bubble sort is often used to introduce the concept of an algorithm, or a sorting algorithm, to introductory [[computer science]] students. However, some researchers such as [[Owen Astrachan]] have gone to great lengths to disparage bubble sort and its continued popularity in computer science education, recommending that it no longer even be taught.&amp;lt;ref name=&amp;quot;Astrachan2003&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[Jargon file]], which famously calls [[bogosort]] &amp;quot;the archetypical [sic] perversely awful algorithm&amp;quot;, also calls bubble sort &amp;quot;the generic &#039;&#039;&#039;bad&#039;&#039;&#039; algorithm&amp;quot;.&amp;lt;ref&amp;gt;http://www.jargon.net/jargonfile/b/bogo-sort.html&amp;lt;/ref&amp;gt; [[Donald Knuth]], in his famous book &#039;&#039;[[The Art of Computer Programming]]&#039;&#039;, concluded that &amp;quot;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&amp;quot;, some of which he then discusses.&amp;lt;ref name=&amp;quot;Knuth&amp;quot;&amp;gt;[[Donald Knuth]]. &#039;&#039;[[The Art of Computer Programming]]&#039;&#039;, Volume 3: &#039;&#039;Sorting and Searching&#039;&#039;, Second Edition. Addison-Wesley, 1998. ISBN 0-201-89685-0. Pages 106&amp;amp;ndash;110 of section 5.2.2: Sorting by Exchanging.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bubble sort is [[Asymptotic notation|asymptotically]] equivalent in running time to [[insertion sort]] in the worst case, but the two algorithms differ greatly in the number of swaps necessary. Experimental results such as those of Astrachan have also shown that [[insertion sort]] performs considerably better even on random lists. For these reasons many modern algorithm textbooks avoid using the bubble sort algorithm in favor of insertion sort.&lt;br /&gt;
&lt;br /&gt;
Bubble sort also interacts poorly with modern CPU hardware. It requires at least twice as many writes as insertion sort, twice as many cache misses, and asymptotically more [[branch prediction|branch mispredictions]]. Experiments by Astrachan sorting strings in Java show bubble sort to be roughly 5 times slower than [[insertion sort]] and 40% slower than [[selection sort]].&amp;lt;ref name=&amp;quot;Astrachan2003&amp;quot;&amp;gt;Owen Astrachan. Bubble Sort: An Archaeological Algorithmic Analysis. SIGCSE 2003 Hannan Akhtar . [http://www.cs.duke.edu/~ola/papers/bubble.pdf (pdf)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In computer graphics it is popular for its capability to detect a very small error (like swap of just two elements) in almost-sorted arrays and fix it with just linear complexity (2n). For example, it is used in a polygon filling algorithm, where bounding lines are sorted by their x coordinate at a specific scan line (a line parallel to x axis) and with incrementing y their order changes (two elements are swapped) only at intersections of two lines.&lt;br /&gt;
&lt;br /&gt;
== Variations ==&lt;br /&gt;
*[[Odd-even sort]] is a parallel version of bubble sort, for message passing systems.&lt;br /&gt;
*[[Cocktail sort]] is another parallel version of the bubble sort&lt;br /&gt;
*In some cases, the sort works from right to left (the opposite direction), which is more appropriate for partially sorted lists, or lists with unsorted items added to the end.&lt;br /&gt;
&lt;br /&gt;
===Alone bubble sort===&lt;br /&gt;
&#039;&#039;Alone bubble sort&#039;&#039; is a 1992 modification{{cn|date=September 2013}} of the simple bubble sorting algorithm. Unlike the normal bubble sort where the loop resets after every performed swap of elements, in the alone bubble sort, the loop index only returns back by one step thus allowing the swapping to continue until a smaller value element in the array is reached. The following is the alone bubble realization (the algorithm only) in Pascal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Pascal&amp;quot;&amp;gt;&lt;br /&gt;
    f:=false;&lt;br /&gt;
    for x:=1 to max-1 do&lt;br /&gt;
        if a[x]&amp;gt;a[x+1] then&lt;br /&gt;
            begin&lt;br /&gt;
                if f=false then d:=x;&lt;br /&gt;
                f:=true;&lt;br /&gt;
                t:=a[x];&lt;br /&gt;
                a[x]:=a[x+1];&lt;br /&gt;
                a[x+1]:=t;&lt;br /&gt;
                if x&amp;gt;1 then dec(x,2) else x:=0;&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            if f=true then&lt;br /&gt;
                begin&lt;br /&gt;
                    x:=d;&lt;br /&gt;
                    f:=false;&lt;br /&gt;
                end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debate Over Name ==&lt;br /&gt;
&lt;br /&gt;
Bubble sort has occasionally been referred to as a &amp;quot;sinking sort,&amp;quot; including by the National Institute of Standards and Technology. [http://xlinux.nist.gov/dads/HTML/bubblesort.html]&lt;br /&gt;
&lt;br /&gt;
However, in Donald Knuth&#039;s &#039;&#039;The Art of Computer Programming&#039;&#039;, Volume 3: &#039;&#039;Sorting and Searching&#039;&#039; he states in section 5.2.1 &#039;Sorting by Insertion&#039;, that [the value] &amp;quot;settles to its proper level&amp;quot; this method of sorting has often been called the &#039;&#039;sifting&#039;&#039; or &#039;&#039;sinking&#039;&#039; technique. Furthermore the &#039;&#039;larger&#039;&#039; values might be regarded as &#039;&#039;heavier&#039;&#039; and therefore be seen to progressively &#039;&#039;sink&#039;&#039; to the &#039;&#039;bottom&#039;&#039; of the list.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [[Donald Knuth]]. &#039;&#039;The Art of Computer Programming&#039;&#039;, Volume 3: &#039;&#039;Sorting and Searching&#039;&#039;, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89685-0. Pages 106&amp;amp;ndash;110 of section 5.2.2: Sorting by Exchanging.&lt;br /&gt;
* [[Thomas H. Cormen]], [[Charles E. Leiserson]], [[Ronald L. Rivest]], and [[Clifford Stein]]. &#039;&#039;[[Introduction to Algorithms]]&#039;&#039;, Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Problem 2-2, pg.38.&lt;br /&gt;
* [https://www.cs.tcd.ie/publications/tech-reports/reports.05/TCD-CS-2005-57.pdf Sorting in the Presence of Branch Prediction and Caches]&lt;br /&gt;
*Fundamentals of Data Structures by Ellis Horowitz, [[Sartaj Sahni]] and Susan Anderson-Freed ISBN 81-7371-605-6&lt;br /&gt;
&lt;br /&gt;
== External links==&lt;br /&gt;
{{wikibooks|Algorithm implementation|Sorting/Bubble_sort|Bubble sort}}&lt;br /&gt;
{{commons category|Bubble sort}}&lt;br /&gt;
{{wikiversity|Bubble sort}}&lt;br /&gt;
* {{cite web | url=http://codecodex.com/wiki/Bubble_sort | title= Bubble Sort implemented in 34 languages}}&lt;br /&gt;
* {{cite web | url=http://www.sorting-algorithms.com/bubble-sort |title = Animated Sorting Algorithms: Bubble Sort | author= David R. Martin}} –  graphical demonstration and discussion of bubble sort&lt;br /&gt;
* {{cite web | url= http://lecture.ecc.u-tokyo.ac.jp/~ueda/JavaApplet/BubbleSort.html |title= Lafore&#039;s Bubble Sort}} (Java applet animation)&lt;br /&gt;
* {{OEIS|A008302}} Table (statistics) of the number of permutations of [n] that need k pair-swaps during the sorting. &lt;br /&gt;
&lt;br /&gt;
{{sorting}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Articles with example pseudocode]]&lt;br /&gt;
[[Category:Sorting algorithms]]&lt;br /&gt;
[[Category:Comparison sorts]]&lt;br /&gt;
[[Category:Stable sorts]]&lt;br /&gt;
&lt;br /&gt;
[[no:Sorteringsalgoritme#Boblesortering]]&lt;/div&gt;</summary>
		<author><name>5.71.118.66</name></author>
	</entry>
</feed>