单链表的逆向打印、删除无头的非尾节点、无头链表插入节点、约瑟环

//1、逆向打印链表(递归)
void PrintTailToHead(ListNode *pHead)
{
                ListNode *cur = pHead;
                 if(cur != NULL)
                {
                                PrintTailToHead(cur->_next);
                                printf( "%d ",cur->_data);
                }
}
//2、删除无头链表中的非尾节点
void DelNoTail(ListNode *pos)
{
                assert(pos && pos->_next );
                ListNode *next = pos->_next ;
                swap(pos->_data ,next->_data );
                pos->_next = next->_next ;
                free(next);
}
//3、无头链表非头结点前插入一个节点
void InsertNoHead(ListNode * pos, DataType x)
{
                ListNode *tmp = BuyNode(pos->_data );
                tmp->_next = pos->_next;
                pos->_next = tmp;
                pos->_data = x;
}
//4、约瑟夫环问题(假设是一个循环单链表)
ListNode* Josephuscycle(ListNode *pHead, DataType x)
{
                ListNode *cur = pHead;
                 while(1)
                {
                                 if(cur = cur->_next )
                                {
                                                 return cur;
                                }
                                DataType m = x;
                                 while(--x)
                                {
                                                cur = cur->_next ;
                                }
                                ListNode *next = cur->_next ;
                                swap(cur->_data ,next->_data);
                                cur->_next = next->_next ;
                                free(next);
                }
}