You are here:

C++/linked list

Advertisement


Question
hello, i was just wondering offhand if you happen to know the correct algorithm for running a bubble sort on a doubly linked list. i wanted to double check what i have and make sure my bubble sort isnt crashing my program.

also, on the 12th of july i applied to be a C++ expert as well and have still not received a response. i feel i am very qualified to answer questions.

thanks a lot,

- Eddie  

Answer
Eddie, Thank you for your question.

No one should use the bubble sort. It is the least efficient of all sorting methods, and is not even the shortest algorithm. It is also arguably not the simplest to understand.

Excellent tutorials on sorting algorithms are available on the Web (search for them).

In the C++ Standard Library, the sort function (from the <algorithm> include file) can be used. It runs in time of the order of n * log(n), where n is the number of items to be sorted, which is the fastest time for general-purpose sorting (that is, where the distribution of the keys is not known in advance). 'sort' is part of the Standard Template Library (search the Web for tutorials on STL).

It is not clear that anyone is currently maintaining AllExperts. See the AllExperts forums for more information.

David Spector

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Spector

Expertise

Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.

Experience

I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Publications
Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

Education/Credentials
ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 About.com. All rights reserved.