|
typedef struct node * node_ptr;
struct node
{
element_type element;
node_ptr next;
};
void sort_list (node_ptr L)
{
node_ptr p, tmp, min;
for (p = L-> next; p! = NULL; p = p-> next)
{
for (tmp = p-> next; tmp! = NULL; tmp = tmp-> next)
{
min = NULL;
if (tmp-> element <p-> element)
{
min = tmp;
}
}
if (min! = NULL)
{
swap (&min-> element,&p-> element);
}
}
} |
|