摘要:
#include<iostream> template <class T> class Queue { private: T rear; T front; int maxSize; T* head; public: Queue(int size):rear(0),front(0),maxSize(size) { head = new T(size); if(!head) std::cout << "memoryAllocationError!" << std::endl; } ... 阅读全文
随笔档案-2012年5月6日
【动手敲代码】:顺序队列(C++)
2012-05-06 18:58 by ATP_, 487 阅读, 收藏,
摘要:
#include<iostream> template <class T> class Queue { private: T rear; T front; int maxSize; T* head; public: Queue(int size):rear(0),front(0),maxSize(size) { head = new T(size); if(!head) std::cout << "memoryAllocationError!" << std::endl; } ... 阅读全文
【动手敲代码】:顺序栈(C++)
2012-05-06 18:57 by ATP_, 386 阅读, 收藏,
摘要:
1 #include<iostream> 2 3 template<class T> 4 class Stack 5 { 6 private: 7 int top; 8 T* base; 9 int size;10 T* elements;11 public:12 Stack<T>(int sz):size(sz),top(-1)13 {14 base = new T[sz];15 if(!base)16 std::cout << "momoryAllocationError" << std::... 阅读全文
【慢慢学算法】:某一天是星期几问题的详解 (蔡勒公式)
2012-05-06 09:48 by ATP_, 3645 阅读, 收藏,
摘要:
刚做的这个题还是收获颇丰的,让人掌握了一种解决此常规问题的算法,蔡勒思路详解希望有兴趣的同志们仔细看看噢,废话不多说,贴题(翻译后)贴思路贴代码; 题目描述: 输入某一天,求出星期几样例输入:9 October 200114 October 2001样例输出:TuesdaySunday 代码: 1 #include<iostream> 2 ... 阅读全文
浙公网安备 33010602011771号