cpppro

Sorting a Linked List with Selection Sort

In C Tidbits, Data Structures in C/C++ on April 29, 2007 at 7:26 pm

The basic idea of selection sorting algorithm is

1)find minimum element in the list
2)swap it with the beginning element
3)repeat the above steps after moving pointer to next element

Here is the graphical representation of operation of this algorithm…

selection sort array pic

Before we go to linked list sorting understand how do we sort for an array…
Here is the C code for selection sort for an array

 

Please refer http://www.refcode.net/2013/02/sorting-linked-list-with-selection-sort.html

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: