Talk:Sorting algorithms/Bubble sort: Difference between revisions

From Rosetta Code
Content added Content deleted
(This is bubble sort?)
Line 4: Line 4:


:Removed. Now for someone to fill in the description of the algorithm... --[[User:Short Circuit|Short Circuit]] 10:53, 31 January 2007 (EST)
:Removed. Now for someone to fill in the description of the algorithm... --[[User:Short Circuit|Short Circuit]] 10:53, 31 January 2007 (EST)

== This is bubble sort? ==

This isn't the bubble sort I've learned. Where did you get this algorithm? This is my bubble sort:
void sort(int *a, int size)
{
int i,j;
for (j=size-1; j>0; j--)
for (i=0; i<j; i++)
if (a[i+1] < a[i])
swap(a+i);
}

Revision as of 17:01, 29 September 2007

Algorithm link

Seems like it would be better for algorithm tasks to include their natural-language description, infobox, and perhaps pseudocode in a top-level section before the examples rather than on a separate page. --Bob9000 07:41, 31 January 2007 (EST)

Removed. Now for someone to fill in the description of the algorithm... --Short Circuit 10:53, 31 January 2007 (EST)

This is bubble sort?

This isn't the bubble sort I've learned. Where did you get this algorithm? This is my bubble sort:

void sort(int *a, int size)
{
  int i,j;
  for (j=size-1; j>0; j--)
    for (i=0; i<j; i++)
      if (a[i+1] < a[i])
        swap(a+i);
}