Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Stack
- {
- class Stack
- {
- Node start = null;
- public void push(int val)
- {
- Node tmp = new Node(val);
- tmp.next = start;
- start = tmp;
- }
- public void pop()
- {
- if (start == null)
- {
- return;
- }
- start = start.next;
- }
- public int top()
- {
- if (start == null)
- {
- return 0;
- }
- return start.info;
- }
- public bool empty()
- {
- return (start == null);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement