typedef struct node = link;
struct node { Item item; link next; }; link NEW ( Item, link);
link init (int); void show (link); link sort (link);
Индексно и указателно сортиране.
1 стъпка от селект.сорт на свързан списък.
link listselection(link h)
{
link max, t, out = NULL; while (h ->next !=NULL)
{ max = findmax(h);
t = max -> next; max ->next = t->next; t-> next = out; out = t; }
h->next = out return (h);
Поддържа се вх. списък( сочен от
h->next) и изходен списък (сочен от Out).