链表定义如下:
struct Node
{
struct Node* next;
int data;
};
非递归反置链表如下:
struct Node* ll_reverse(struct Node* head)
{
if(head==NULL)
{
return NULL;
}
else
{
struct Node* pre = NULL;
struct Node* next = NULL;
struct Node* ptr =[......]
原地反置链表(非递归和递归)
Leave a reply