单循环链表-创建、插入、删除、反转等操作
//list.h
#include "singleList.h"int main(void){int array[] = {1,2,3,4,5,6,7,8,9,10};int len = sizeof(array)/sizeof(*array);int insertvalue = 100;Position p;pList head = creatList(array,len);printList(head->next); head = reversalList(head->next); printList(head); p = findNode(head,5); printf("the position value is : %d\n",p->value);//在元素为10前面插入100head = InsertList(head,10,insertvalue);printList(head);//删除10000的节点head = deleteNode(head,10); printList(head);//删除头节点head = deleteNode(head,1);printList(head);//释放链表head = freeList(head);printList(head);}
与单链表相比,在插入和删除操作都简化了。