链表升序
来源:互联网 发布:windows消息机制详解 编辑:程序博客网 时间:2024/04/29 06:39
建立一个升序链表并遍历输出
struct LNode{int data;LNode* next;};void Insert(LNode* List, int data){LNode* tmp=new LNode;tmp->data = data;tmp->next = NULL;LNode* pre, *now;now = List->next;pre = List;while (now!=NULL&&now->data<data){pre = now;now = now->next;}tmp->next = now;pre->next = tmp;}void slove(){int x,n;LNode * head = new LNode;while (~scanf("%d",&n)){head->next = NULL;head->data = 0;for (int i = 0; i < n; ++i){scanf("%d", &x);Insert(head, x);}LNode *now = head->next;while (now){if (now->next == NULL)printf("%d", now->data);elseprintf("%d ", now->data);now = now->next;}printf("\n");}}
0 0
- 建立升序链表
- 链表升序
- 两个升序链表合成一个升序链
- 合并两个升序链表
- 两升序链表合并
- 升序链表的基本操作
- 基于升序链表的定时器实现
- 合并两个升序线性链表
- 关于链表的升序排列问题
- 九度oj 1181 升序链表
- 两个升序单向链表的合并
- 双向链表list.h升序排序
- 合并两个升序链表(递归)
- 合并两个链表成一个升序链表
- 合并两个链表成一个升序链表
- 基于升序链表的定时器
- 将两个升序链表合并成一个 升序链表
- 向升序排列的单链表中插入一个值,要求插入后仍为升序链表
- 解决linux下sudo更改文件权限报错xxxis not in the sudoers file. This incident will be reported.
- 《JAVA与模式》之模板方法模式
- ViewPager轮播 + 小圆点
- bzoj 1604: [Usaco2008 Open]Cow Neighborhoods 奶牛的邻居(set+并查集)
- 内部类
- 链表升序
- mysql_real_connect(): Access denied for user 'root'@'localhost' (using password: YES)
- maven 推荐网址
- JSP页面间传值、前后端传值及EL表达式
- 互联网产品“冷启动”问题及解决办法
- HandlerThread(子线程也可以有消息传递机制)
- 重写与重载的区别
- 二分查找法与链表算法
- ArcGIS平台中PostgreSQL数据连接配置总结(转)