2013年3月28日
摘要: 算法导论上,第10章的一个练习,用一个数组实现存储两个栈,使的每个栈的push和pop的时间都是O(1) 1 #ifndef DOUBLESTACK_H 2 #define DOUBLESTACK_H 3 4 #define TOTAL 10 5 6 template<class T> 7 class double_stack 8 { 9 T m_array[20]; 10 int m_top1, m_end1; 11 int m_top2, m_end2; 12 public: 13 double_stack(); 14 voi... 阅读全文
posted @ 2013-03-28 11:21 blue firmament 阅读(356) 评论(0) 推荐(0) 编辑