Thanks.
Printable View
Thanks.
The algorithm is :
Darwen.Code:If N is node to swap and N->Next is next in list then to swap N and N->Next
If N is end of list (i.e. N->Next == null) Then Error
If N is Head of list then
Head of list = N->Next
N->Next = Head of list->Next
Head of list->Next = N
Else
Find Previous node to N.
Previous node To N->Next = N->Next
N->Next = Previous node to N->Next
Previous Node to N->Next = N