摘要
目的:向栈中依次输入若干字符,输出所有不同的出栈序列.方法:根据栈后进先出的特征,采用链表确定字符进栈的所有时刻序列,输出字符的所有出栈序列.结果:抛开烦琐的组合数学证明,充分利用数据结构中链表、栈来解决出栈序列问题,并用C++程序描述了该算法.结论:从进栈出栈具有时刻先后关系出发,解决出栈序列问题,算法理解更为简单直观.
Aim: Input some characters into the stack in turn, and output all the different stack sequences. Method: According to the characteristics of the stack of later in and first out, all the time sequence of characters is determined by the linked list. Result: Avoid the complex proof of combinational mathematics, make full use of linked list and stack in data structures to solve the problem of stack sequence, and describe the algorithm by C++ program. Conclusion: It will be much easier to understand the algorithm if the problems of the stack sequence are solved, which starts with the different sequence of input and output of the stack sequence.
出处
《河北北方学院学报(自然科学版)》
2006年第5期70-75,共6页
Journal of Hebei North University:Natural Science Edition
关键词
栈
时刻
序列
链表
stack
time
sequence
linked list