文章标题
来源:互联网 发布:侧铣头编程讲解 编辑:程序博客网 时间:2024/06/08 04:15
单链表逆序的两种方法
typedef ElemType int;
typedef struct node
{
ElemType data;
struct node *next;
}Node;
Node *reverse(node *head)
{
Node *p, *q, *r;
if(head->next == NULL || head == NULL){ return head;}p = head;q = head->next;while(q){ r = q->next; q->next = p; p = q; q = r;}head->next = NULL;head = p;return head;
}
Node *Reverse(Node *head)
{
Node *newHead;
if(head == NULL || head->next == NULL){ return head;}newHead = Reverse(head->next);head->next->next = head;head->next = NULL;return newHead;
}
阅读全文
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 详谈PHP垃圾回收机制
- 地球是平的?!
- < Android 源码分析(0)> Android 8.0 源码下载编译
- CVE-2012-4792
- linux下的yum环境的搭建问题CR
- 文章标题
- linux网络编程
- 我的第一篇博客
- Kafka史上最详细原理总结
- A Magic Lamp HDU
- 关于FbinstTool加入360急救盘见解
- 医院挂号抢号助手--寻票软件
- JVM-JvisualVM部署及Tomcat监控实例(基于客户端jdk1.8.0_144和服务端tomcat7.0.47)
- 计算机网络小知识整理