链表
ABNQ-CN
这个作者很懒,什么都没留下…
展开
-
双链表-双链表的排序(非节点值排序,而是节点排序)
双链表的排序 #include <stdio.h> #include <stdlib.h> // 双链表 typedef struct node_t{ int val; int idx; struct node_t *next, *prev; }in, *in_p; void showList( struct node_t *h ) { printf("++++++++++++showList+++++++++++++\n"); while( h ){ pri原创 2020-06-19 17:29:34 · 138 阅读 · 0 评论 -
链表-链表的排序(非节点值的排序,而是节点排序),对什么排序又排序函数的参数决定(条件函数)
节点排序的函数 int cmpScore( struct node_t *n1, struct node_t *n2 ) { return n1->score - n2->score; } int cmpVal( struct node_t *n1, struct node_t *n2 ) { return n1->val - n2->val; } void sortList( struct node_t **h, int (*fp)(struct node_t *,原创 2020-06-18 19:34:44 · 165 阅读 · 0 评论 -
链表-在链表中找到想找的值,并把想找的值摘取出来形成新的链表而原来的链表只是提出了想找的结点。以及链表的2种头插和2中尾插法
2种头插法的写法 //第一种方法 struct node_t* insertHead( struct node_t *h, struct node_t *n ) { n->next = h; return n; } //第二种方法 void insertHead1( struct node_t **h, struct node_t *n ) { n->next = *h; *h = n; } 2种尾插法的写法 //第一种方法 struct node_t *insertTail(原创 2020-06-18 19:15:36 · 175 阅读 · 0 评论