Linked List Bubble Sort

Hey everyone, I've just finished doing a Bubble sort algorithm for my double ended linked list, I'd just like to get everyone's opinions on it and to check if I could make some improvements or if I made any big mistakes.

Here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	ListElement *Sort()
	{
		ListElement *iter = First(), *list = Last();

		while (iter != Last())
		{
			while (list != First())
			{
				if(strncmp(list->mData, list->mPrev->mData, 256) > 0)
					swap(list->mData, list->mPrev->mData);

				list = list->Previous();
			}
			iter = iter->Next();
		}
		return list;
	}
Topic archived. No new replies allowed.