摘要: 抛砖引玉: 作用说明: 【way 1】 这是面向对象编程中的东西。 首先你要有一个类的概念,如果没有类的概念,就不会知道为什么需要private、protected和public。 类首先是一种抽象,是一个定义。比如说人类就是一个抽象的定义,具体到我们每个人就是这个类的对象。虽然你我都属于人类,但可 阅读全文
posted @ 2018-08-16 23:49 蓝莓派Alex 阅读(1266) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 程序代码: 【方法一】 1 class Solution 2 { 3 public: 4 5 void push(int node) { 6 stack1.push(node); 7 8 9 } 10 阅读全文
posted @ 2018-08-16 23:42 蓝莓派Alex 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 5 /*分配二维数组的内存空间*/ 6 int fenpei(int row, int col) 7 { 8 int i; 9 int **array; 10 11 if ((array = (int **)malloc(row *sizeof (int *)... 阅读全文
posted @ 2018-08-16 19:25 蓝莓派Alex 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1 //这是一个链式堆栈的判空、压栈、出栈、取栈顶等操作 2 #include 3 #include 4 #include 5 6 7 #define MaxSize 100 8 typedef int bool; 9 #define T 1 10 #define F 0 11 12 typedef int DataType; 13 typ... 阅读全文
posted @ 2018-08-16 16:57 蓝莓派Alex 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 //#include 4 5 //定义抽象数据 6 typedef int DataType; 7 typedef struct queue{ 8 DataType data; 9 struct queue *next; 10 }Queue; 11 12 //定义链式队列的头尾指... 阅读全文
posted @ 2018-08-16 16:30 蓝莓派Alex 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 1 //这是一个循环顺序队列的判空、压栈、出栈、取栈顶等操作 2 #include 3 4 #define MaxSize 100 5 typedef int bool; 6 #define T 1 7 #define F 0 8 9 typedef int DataType; 10 typedef struct queue{ 11 Data... 阅读全文
posted @ 2018-08-16 09:35 蓝莓派Alex 阅读(265) 评论(0) 推荐(0) 编辑