zoukankan      html  css  js  c++  java
  • [算法] 链栈的实现

    #include <iostream>
    #include <string>
    #include <cstring>
    #include <cstdlib>
    #include <cstdio>
    #include <cmath>
    #include <vector>
    #include <stack>
    #include <deque>
    #include <queue>
    #include <bitset>
    #include <list>
    #include <map>
    #include <set>
    #include <iterator>
    #include <algorithm>
    #include <functional>
    #include <utility>
    #include <sstream>
    #include <climits>
    #include <cassert>
    #define BUG puts("here!!!");
    /* linkStack C++ */
    using namespace std;
    struct Node {
    	char value;
    	Node* next;
    };
    bool push(Node* top, char x) {
    	Node* temp;
    	temp = new Node();
    	if(temp == NULL) return false;
    	temp->value = x;
    	temp->next = top->next;
    	top->next = temp;
    	return true;
    }
    bool pop(Node* top) {
    	Node* temp = top->next;
    	if(temp == NULL) return false;
    	top->next = temp->next;
    	delete temp;
    	return true;
    }
    char getTop(Node* top) {
    	if(top->next != NULL) return top->next->value;
    	return '#';
    }
    int main() {
    	return 0;
    }
    

  • 相关阅读:
    特殊符号大全
    CSS速记
    JavaScript命名规范
    vim 常用快捷键
    Set a mouse hook
    ASP不可遗弃的通用函数
    ASP递归层级表格数据展示
    最简约JS日历控件
    ASP统计图
    ASP标准MD5代码
  • 原文地址:https://www.cnblogs.com/robbychan/p/3787135.html
Copyright © 2011-2022 走看看