#include <iostream>
#include <cstddef>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int d){
data=d;
next=NULL;
}
};
class Solution{
public:
Node* insert(Node *head,int data)
{
Node *temp = new Node(data);
if(head == NULL){
head = temp;
return head;
}
Node *q, *p;
p = head;
q = head -> next; while(q){
p = q;
q = p -> next;
} p -> next = temp;
return head;
}
void display(Node *head)
{
Node *start=head;
while(start)
{
cout<<start->data<<" ";
start=start->next;
}
}
};
int main()
{
Node* head=NULL;
Solution mylist;
int T,data;
cin>>T;
while(T-->){
cin>>data;
head=mylist.insert(head,data);
}
mylist.display(head); }

最新文章

  1. 【分布式】Zookeeper的Leader选举
  2. Java三大框架之——Hibernate
  3. c++共享内存(转载)
  4. ThroughRain第一次冲刺总结
  5. Windows下MongoDB安装与设置
  6. java 14 -7 Date
  7. 二叉树建立,先序、中序、后序遍历(c实现)
  8. Apache Thrift - 可伸缩的跨语言服务开发框架
  9. vi/vim使用指北 ---- Sample Editing
  10. VC++6.0连接Access数据库
  11. awk里的各种坑
  12. commons-pool2-中的一些配置
  13. 使用 CXF 做 webservice 简单例子[转]
  14. 算法笔记_015:快速排序(Java)
  15. postman 第3节 API请求和查看响应结果(转)
  16. WebForm+一般处理程序+Ajax聊天
  17. Java 消除过期的对象引用
  18. 消息对话框 MessageBoxButtons
  19. 学习STM32,你不得不了解的五大嵌入式操作系统
  20. WPF模拟探照灯文字

热门文章

  1. MFC文档、视图和框架
  2. [原]Java面试题-将字符串中数字提取出来排序后输出
  3. Idiomatic Python手记一: average in FP way
  4. NOIP2011 观光公交
  5. Thinking in Java
  6. POJ1149 PIGS
  7. [学姿势]实验室搬砖+node学习
  8. LIMITS.H
  9. mssql触发器demo
  10. Lambda表达式的由来