Tuesday, March 30, 2010

Best Quote ever


public static List BubbleSort(this List array)
where T: IComparable
{
List sortedArray = new List(array);
bool sorted = true;
do
{
for (int i = 0; i < sortedArray.Count - 1; i++)
{
if (sortedArray[i].CompareTo(sortedArray[i + 1]) > 0)
{
T temp = sortedArray[i];
sortedArray[i] = sortedArray[i + 1];
sortedArray[i + 1] = temp;
sorted = false;
}
}
}while (!sorted)
return sortedArray;
}


That is an implementation of the Bubble sort. It's one of the first sorts you learn about in Computer Science. It's simple to understand, but is one of the worst sorting algorithms.

A professor I had for a Data Structures class stated the following about Bubble Sort.

"Bubble Sort is like a transvestite hooker in the French Quarter of New Orleans. It looks really good, but it isn't"

That's always been one of my favorite quotes. If you got any better ones let me know.

1 comment:

  1. Dude, did you solve this out?
    http://stackoverflow.com/questions/3158312/open-all-files-when-user-right-clicks-and-selects-open-with

    ReplyDelete