![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
爱憎分明丶
汇编,Vue,python,sql,Django,c,c ,java,ThinkPHP,php,solr,hadoop,小程序,公用号。
展开
-
蓝桥杯训练-带分数
问题描述100 可以表示为带分数的形式:100 = 3 + 69258 / 714。还可以表示为:100 = 82 + 3546 / 197。注意特征:带分数中,数字1~9分别出现且只出现一次(不包含0)。类似这样的带分数,100 有 11 种表示法。输入格式从标准输入读入一个正整数N (N<1000*1000)输出格式程序输出该数字用数码1~9不重复不...原创 2019-11-30 18:02:04 · 131 阅读 · 0 评论 -
蓝桥杯练习-打印十字图
问题描述小明为某机构设计了一个十字型的徽标(并非红十字会啊),如下所示:..$$$$$$$$$$$$$....$...........$..$$$.$$$$$$$$$.$$$$...$.......$...$$.$$$.$$$$$.$$$.$$.$...$...$...$.$$.$.$$$.$.$$$.$.$$.$.$...$...$.$.$$.$.$.$$$$$.$.$....原创 2019-11-29 23:54:38 · 142 阅读 · 1 评论 -
C++ 哈弗曼树类 创建哈弗曼树、输出哈弗曼树、输出哈弗曼编码
#include <stdlib.h>#include <iostream>int *findMin(struct TreeNode *trees,int length);using namespace std;struct huffmanCode{ int *p; int start;};struct TreeNode{ int wight; int...原创 2019-08-05 22:23:44 · 411 阅读 · 0 评论 -
C++ 二叉树类 创建、插入、删除 源代码
#include <stdio.h>#include <iostream>#include <stdlib.h>#include <windows.h> using namespace std;struct TreeNode{ struct TreeNode *left; struct TreeNode *right; float ...原创 2019-08-04 11:16:07 · 1280 阅读 · 0 评论 -
链表二叉树
#include <stdio.h>#include <iostream>#include <stdlib.h>using namespace std;struct TreeNode{ float data; struct TreeNode *left; struct TreeNode *right;};print(struct Tre...原创 2019-07-31 12:26:15 · 122 阅读 · 0 评论 -
结构体数组二叉树
#include<stdio.h>#include<iostream>#include<stdlib.h>using namespace std;class TreeNode{ public: int left; int right; float data; public : TreeNode(){ this->lef...原创 2019-07-31 12:25:46 · 415 阅读 · 0 评论 -
数组二叉树
如果二叉树节点从数组下标1开始,那么左子树下标就是2*n,右子树就是2*n+1#include <iostream>#include <stdio.h>#include <stdlib.h>#include <memory.h>using namespace std;float* createTree(){ int n,level...原创 2019-07-31 12:24:35 · 256 阅读 · 0 评论 -
重温排序算法 快速排序
前言:本文参考了百度百科,并且修改补充了部分内容,代码自己再实现了一遍,并且注释,简单易懂.概念:设要排序的数组是A[0]……A[N-1],首先任意选取一个数据(通常选用数组的第一个数)作为基准数,然后将所有比它小的数都放到它左边,所有比它大的数都放到它右边,然后把基准数放在中间位置,再把数组分成两部分, 对两部分分别执行上述操作。值得注意的是,快速排序不是一种稳定的排序算法,也就是说...原创 2019-05-22 23:12:17 · 141 阅读 · 0 评论 -
C语言 详解DFS-深度优先搜索和其基本结构
最近学图的时候 ,遇到图的遍历看不懂了,发现需要用到DFS-深度优先搜索或者BFS-广度优先搜索,于是就翻了翻资料 顺便写个笔记和心得.我们以数的全排列为例子 , 输出前N个数的的全排列 (如果用枚举法会很简单 但是我只是用这种简单的问题引出DFS的写法)#include<iostream>using namespace std;void DFS(int step);i...原创 2019-05-12 21:27:27 · 5977 阅读 · 0 评论 -
重温排序算法 冒泡排序
冒泡排序算法的原理如下: 比较相邻的元素。如果第一个比第二个大,就交换他们两个。 对每一对相邻元素做同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。 针对所有的元素重复以上的步骤,除了最后一个。 持续每次对越来越少的元素重复上面的步骤,直到没有任何一对数字需要比较 上代码:#include<iostream>...原创 2019-05-21 15:47:12 · 106 阅读 · 0 评论 -
C++ 语言二分法查找 递归和循环实现 带详细注释
#include<stdio.h>#include<iostream>using namespace std;//循环 int binarySearch(int* arr,int num,int length){ //数组 查询值 数组长度 int low=0,len=length;//初始化起点和终点 while(low<=len){//起点小于等...原创 2019-05-19 22:08:05 · 373 阅读 · 0 评论 -
C++ 广度优先搜索 BFS 解最短路径问题
#include<stdio.h>#include<iostream>#include<queue>//点位结构体; using namespace std;struct point { int x; int y; int step;};queue<point> que; //点位列队 int map[51][51],book...原创 2019-05-19 14:23:45 · 2900 阅读 · 2 评论 -
C++ 遇到reference to ' *** ' is ambiguous 错误
今天写C 算法的时候 声明了一个全局遍历 min 来记录最短路径,编译发现遇到一个以前没遇到过的错误:reference to ' min' is ambiguous翻译过来就是对min的引用有歧义.通过查询百度发现 原来是我引用了iostream 等库,跟里面的属性或者方法重名了.把min变量改个名字就行了.很简单我就不贴错误代码了...原创 2019-05-19 01:22:04 · 51895 阅读 · 11 评论 -
DFS 求最短路径 C++
假设 一张地图 N行M列 ,0表示通畅1表示障碍物,P,Q表示终点坐标.求点(0,0)到(P,Q)最短路径#include<iostream>#include<stdio.h>int minS=999999;//最小路程minS 防止和iostresm 里面的min命名冲突 int map[51][51]={0};//地图 int book[51][51]=...原创 2019-05-19 01:08:06 · 2392 阅读 · 0 评论 -
C++ STL Queue 解决搭档问题
#include<iostream>#include<string>#include<queue>using namespace std;int main(void){ queue<char> man; queue<char> woman; string str; int m,n,k;//男士人数 女士人数 第K轮 ...原创 2019-04-28 13:38:05 · 257 阅读 · 0 评论 -
C++ string 行编辑程序
#include<iostream>#include<string>using namespace std;int main(void){ string str; string str1; cin>>str; for(int i;i<str.length();i++){ switch (str[i]){ case '#':{ ...原创 2019-04-23 16:38:55 · 457 阅读 · 0 评论 -
C++ stack 判断回文
#include<iostream>#include<stack>#include<string> using namespace std;int main(void){ stack<char> stk; string s; cin>>s; int len=s.length();//字符串长度 int mid=l...原创 2019-04-23 16:38:04 · 778 阅读 · 0 评论 -
C++ 后续表达式 写的时候用STL库里的Stack类的时候遇到的坑 附上代码和注释
#include<iostream>#include<string>#include<stack>using namespace std;int main(void){ int i; string str;//输入 string s;//表达式 stack<char> stk; cin>>str; for(...原创 2019-04-25 20:52:22 · 382 阅读 · 0 评论