|
|
|||
|
|
|
||
|
Posted by Guy Lecky-Thompson May 29, 2007 |
In creating some tutorial style articles for the site, I checked some of the most popular search terms, and a few kept coming back - searching, sorting, swapping and linked lists. So, I thought I'd gather together some existing wisdom for you, while I prepare the definitive guide to sorting linked lists.
First off, two ways to sort a C++ linked list. We look at an insertion sort, and how it can be used, as well as a couple of alternatives, along with some advice on which one to choose. More concentrated information on sorting you will not find:
Two Ways to Sort a C++ Linked List
For those not scared of a bubble sort tutorial, the Alphabetizing article is a great place to start:
Alphabetizing a Linked List in C
It actually occurred to me after re-reading this one, that there is a much better way to do it. If you've read it, then you'll spot immediately what that is, and it revolves around maintaining several lists of sorted data, based on the same starting letter or letters.
That's enough hints.
Then, there are a couple of swapping articles, for those having issues with understanding a three step swap:
Program for Swapping Integers in C
Swapping Techniques in C Programming
And, as usual, there are more in the works. Requests to me, please - computerprogramming(at)suite101(dot)com.
Happy Swap/Search/Sorting!