有序单链表合并(递归法)
2015-07-31 21:51
253 查看
只是提供思路,缺少很多边界条件的检查
/* 递归法实现有序单链表的合并 */ LinkedList *MergeRecursive(LinkedList *head1, LinkedList *head2) { if (head1 == NULL) return head2; if (head2 == NULL) return head1; LinkedList *head = NULL; if (head1->iValue < head2->iValue) { head = head1; head->next = MergeRecursive(head1->next, head2); } else { head = head2; head->next = MergeRecursive(head1, head2->next); } return head; }
相关文章推荐
- C#接口性能测试--计算执行时间
- Android 通过Uri获取Bitmap对象
- 《差分约束系统》详解
- gb2312网页转码输出utf-8格式文本
- 写给自己
- CentOS 7 下的MySQL安装以及C连接MySQL
- super和this的使用
- HTTP基本知识概况
- C#中的线程
- CSS中*和body的区别
- 关于分布式系统的数据一致性问题
- Android--基于Message的进程间通信
- javascript数据结构
- Sort List
- VBScript使用CDO.Message发送邮件
- DT大数据梦工厂 第5讲
- PHP程序的执行流程
- POJ 1328 Radar Installation(贪心)
- css页面布局5.6
- 2015.7.31