随笔分类 -  C++数据结构

摘要:class Solution {public: int Add(int num1, int num2) { while(num2!=0) { int tmp=num1^num2;//得到相加以后没有进位的数 num2=(num1&num2)<<1;//进位 num1=tmp; } return nu 阅读全文
posted @ 2016-06-05 19:39 ranran1203 阅读(171) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std;template<class T>class SqQueue{ protected: int front,rear; int maxSize; T *elem; public: SqQueue(int size); ~Sq 阅读全文
posted @ 2016-05-31 17:03 ranran1203 阅读(153) 评论(0) 推荐(0)
摘要:#include<iostream> template<class T>struct Node{ T data; Node<T> *next;};template<class T>class Queue{private: Node<T> *front, *rear;public: Queue(); 阅读全文
posted @ 2016-05-31 16:03 ranran1203 阅读(125) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std;template <class T>struct Node{ T data; Node<T> *next;};template <class T>class List{public: List(int len); ~Lis 阅读全文
posted @ 2016-05-31 14:12 ranran1203 阅读(120) 评论(0) 推荐(0)