【剑指offer-解题系列(15)】反转链表
来源:互联网 发布:招商银行java面试 编辑:程序博客网 时间:2024/06/15 15:32
题目描述
输入一个链表,反转链表后,输出链表的所有元素。
分析
使用递归比较方便
代码实现
ListNode* ReverseList(ListNode* pHead) {
if(pHead==NULL)return NULL;
if(pHead->next==NULL)return pHead;
else{
ListNode* p =ReverseList( pHead->next) ;
pHead->next->next=pHead;
pHead->next=NULL;
return p;
}
}
阅读全文
0 0
- 【剑指offer-解题系列(15)】反转链表
- 剑指offer系列源码-反转链表
- 【剑指offer系列】 反转链表___16
- python 剑指offer系列:反转链表
- 剑指offer系列之十四:反转链表
- 剑指offer系列之14:反转链表
- 剑指Offer系列-面试题16:反转链表
- 剑指Offer(15)______反转链表
- 剑指offer 15-反转链表
- 剑指offer(15)—反转链表
- 牛客网-剑指offer-15-反转链表
- 反转链表(剑指offer)
- 剑指offer(17):反转链表
- 剑指offer(12)-反转链表
- 剑指offer(十五)反转链表
- 剑指Offer——(15)反转链表
- 剑指offer第15题(反转链表)
- 剑指offer:反转链表
- OpenWRT系统编译
- CountDownLatch--一组线程完成后其他线程才执行(二)
- 表单验证
- bash shell 学习笔记
- 算法:图的普里姆算法最小生成树-数据结构(22)
- 【剑指offer-解题系列(15)】反转链表
- html5调用手机相机并压缩、上传
- android gps机制分析--之三
- 女装大佬
- 1142: 简单的事情
- css 布局中的 BFC
- Largest Rectangle in Histogram
- LeetCode 338. Counting Bits
- Android开发常见问题之"Failed to convert @drawable/xx into a drawable Exception details are logged in Window