用单链表实现栈 Linked List implementation of stacks
来源:互联网 发布:cyberlink是什么软件 编辑:程序博客网 时间:2024/05/16 19:49
struct Node{int data;Node* next;};Node* top = NULL;void Push(int x){Node* tmp = (Node*)malloc(sizeof(Node));tmp->data = x;tmp->next = top;top = tmp;}void Pop(){if(top == NULL)return;Node* tmp = top;top = top->next;delete tmp;}int Top(){if(top!=NULL)return top->data;}void PrintStack(){if(top == NULL)return;Node* tmp = top;while(tmp != NULL){cout << tmp->data << " ";tmp = tmp->next;}cout << endl;}
0 0
- 用单链表实现栈 Linked List implementation of stacks
- 用数组实现栈 Array implementation of stacks
- important points of linked list and stacks
- Implementation of linked list in C
- Implementation of Static Linked List ( in C/C++ )
- 【Coursera】Algorithms, Part I 算法C++实现:Stacks Linked-list
- 用数组实现栈(Stacks)、队列(Queue)和双向链表(Doubly Linked List)的伪代码
- An implementation of Skip list
- 单链表的C++实现 Implement of Linked List
- Reverse linked list using stack and stack's implementation
- double linked list of kernel
- Intersection of Two Linked List
- Intersection Of Two Linked List
- 栈(stacks)数组实现
- Get middle element of a linked-list
- 两个指针-Remove duplicates of linked list
- intersection of two linked list|leetcode c++
- 【Leetcode】Intersection of Two Linked List
- 很酷的C语言技巧
- 我们需要啥样的云呐
- 孤独
- 蓝桥杯:带分数(全排列)
- 动态规划(一)之背包问题
- 用单链表实现栈 Linked List implementation of stacks
- android项目之RRS阅读器
- ios 渐变
- Android SD卡路径问题以及如何获取SDCard 内存
- Duilib扩展《01》— 双击、右键消息扩展
- 转载:函数实现不放在头文件的原因,及何时可以放头文件的情况
- NGUI小地图制作过程
- Linux 内存管理浅析
- NGUI插件式小地图