【数据结构_链表_List_0957】逆序输出链表
2017-03-06 21:16
344 查看
#include <stdlib.h> #include <stdio.h> #include <iostream> using namespace std; typedef struct node { char str; struct node *next; }List; int main() { List *head,*p,*q,*temp; head=(List *)malloc(sizeof(List)); int num; while(cin>>num) { int i; p=head; for(i=0;i<num;i++) { q=(List *)malloc(sizeof(List)); cin>>q->str; p->next=q; p=q; } p->next=NULL; temp=head; temp=temp->next; while(num>0) { i=0; for(;i<num-1;i++) { temp=temp->next; }cout<<temp->str<<" "; temp=head->next; num--; } } return 0; }
相关文章推荐
- 数据结构--单链表逆序输出
- C++的标准模板库STL中实现的数据结构之链表std::list的分析与使用
- C语言数据结构(链表)单向链表的创建删除逆序
- 步步为营(八)常用数据结构(1)STL-List(双端链表)
- [华为机试练习题]24.删除链表中的反复节点、剩余节点逆序输出
- 链表的逆序输出
- 程序员面试题精选100题(31)-从尾到头输出链表[数据结构]
- 【Redis源码剖析】 - Redis内置数据结构之双向链表list
- C语言实现单链表逆序与逆序输出实例
- C#SortedList排序列表怎么样逆序输出
- 【Linux内核数据结构】最为经典的链表list
- 数据结构和算法 python(1)链表 list
- 单链表的动态建立和逆序输出
- python数据结构:bitmap,list链表,树,图
- 【数据结构】用C++实现双循环链表的各种操作(包括头删,尾删,插入,逆序,摧毁,清空等等)
- 编写一个循环将list容器的元素逆序输出
- 数据结构学习中的简单问题(一):用链表方式实现的队列输出杨辉三角
- 单链表逆序输出的几种实现方式
- 删除链表中的重复节点、剩余节点逆序输出
- 链表创建 然后逆序 然后输出 上机测试题