
<成长记录>
文章平均质量分 77
H992109898
这个作者很懒,什么都没留下…
展开
-
STL sort简单用来快速排序
1.首先,头文件是。2.好了,现在来说一说它的简单用法。(1)2个参数版本:有int num[100];要从num[0]到num[99]排序,只需要sort(num,num+100);第一个参数为起始地址,第二个参数为最后地址的下一个地址。但是2个参数只能用来升序排序。(2)3个参数 sort(num,num+100,cmp);可以进行自定义排序啦,bool c原创 2016-01-16 16:48:32 · 1467 阅读 · 0 评论 -
栈的应用:中缀表达式转化为后缀表达式(逆波兰表达式)
#include #include #include #include "MyownStack.h"using namespace std;const int Max = 1000;int main(){ MyOwnStack s; char c,e; cout while(1){ s原创 2016-02-04 20:06:40 · 1248 阅读 · 0 评论 -
优先队列
template class priorityQueue{ public: priorityQueue(); virtual ~priorityQueue(); void insertQueue(T e); T pop(); int getNumOfQueue(){ return num; } pr原创 2016-02-21 20:05:38 · 390 阅读 · 0 评论 -
栈的应用:逆波兰表达式
栈的应用:逆波兰表达式输入:逆波兰表达式。要求:1 .每个数字和符号之间用空格隔开。 2 .以#结尾,输出其结果。输出:式子结果代码如下(用的栈是刚刚自己写的哈,就在另外一篇博客里面):#include #include #include #include "MyOwnStack.h"using namespace std; int main() {原创 2016-02-04 20:02:17 · 1263 阅读 · 0 评论 -
动态栈的实现(C++)
#include using namespace std;const int STACKINCREMENT = 20;const int STACK_INIT_SIZE = 10;template class MyOwnStack{ public: MyOwnStack(); virtual ~MyOwnStack(); in原创 2016-02-04 18:32:05 · 1158 阅读 · 0 评论 -
骑士周游问题(暴力解决:回溯法)
建议测试数据 3 0 或 4 0原创 2016-02-16 13:35:03 · 5244 阅读 · 0 评论 -
优先队列的实现及其在哈夫曼编码中的应用
虽然哈夫曼树才是写了好久的。原创 2016-02-14 19:29:22 · 909 阅读 · 0 评论 -
大一上学期 (回顾和展望)
没有摘要!原创 2016-01-30 23:00:18 · 2723 阅读 · 0 评论 -
线索二叉树的创建、中序遍历、左右插入
弄了一天- -!原创 2016-02-10 13:02:49 · 1568 阅读 · 0 评论 -
二叉树的创建和遍历
/*-----------------------------Mission:1.建立二叉树,输入^表示空节点。2.遍历二叉树,打印所在层数-----------------------------*/#include #include using namespace std;struct binTreeNode{ char data; binTreeNod原创 2016-02-08 21:54:01 · 525 阅读 · 0 评论 -
队列
template class Hqueue{ public: Hqueue(); virtual ~Hqueue(); void insertQueue(T e); T deleteQueue(); int getNumOfQueue(){ return num; } protected:原创 2016-02-05 20:17:28 · 382 阅读 · 0 评论 -
字符串模式匹配
一.暴力匹配(时间复杂度n*m) 2个字符串长度相乘int bruteForce(char *str, char *pat){ int i,j; for(i = 0,j = 0; ; i++,j = 0){ while(str[i] == pat[j]){ i++,j++; if(!pat[j])原创 2016-02-07 11:13:25 · 356 阅读 · 0 评论 -
在考C++的前一天晚上(一天的学习总结)
在今天开始之前,一直以为C++有什么鬼好复习的,然后看了下班群好像别人都在复习得很认真的样子。然后我就看了一下习题。挖槽,好多不会- -!现在开始:一.指针数组和数组指针。指针数组:array of pointers,即用于存储指针的数组,也就是数组元素都是指针定义char *p[10];数组指针:a pointer to an array,即指向数组的指针定义char (原创 2016-01-17 21:16:20 · 838 阅读 · 0 评论 -
随机漫步模拟
问题描述:在矩形的房间里,铺有N*M块瓷砖,现将一只醉酒的蟑螂放在地板中间的一个指定方格里。蟑螂在房间随机从一块瓷砖漫步到另一块瓷砖。假设它可能从所在的瓷砖移动到其周围八块瓷砖中的任何一个(除非碰到墙壁)。那么,它至少接触每块瓷砖一次,将花费多少时间?#include #include #include using namespace std;const int Max=5原创 2015-12-17 19:25:11 · 1069 阅读 · 0 评论 -
弱菜之快速排序实现,表示因为书上的看不懂只能自己写
自己的代码:void qsort(int a[], int left, int right){ if(left<right){ int pivot=a[left],l=left,r=right; while(l<r){ while(a[r]>=pivot&&l<r) r--; a[l]=a[r]; while(a[l]<=pivot&&l<r) l++;原创 2016-01-04 19:31:34 · 758 阅读 · 0 评论 -
大二上学期(回顾与展望)
————写在大二下学期开学的前一天本来懒得写的,为了交作业原创 2017-02-19 14:26:11 · 2597 阅读 · 1 评论