自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 资源 (2)
  • 收藏
  • 关注

原创 杨辉三角(pascal's triangle)

输入行数,输出对应的杨辉三角本题所用: C(n,0)=1 C(n,k)=C(n,k-1)*(n-k+1)/k运行结果如下: //输入行数,输出对应的杨辉三角#include <iostream>#include <cstdlib>#include <vector>using namespace std;int main() { int n; std::cin >> n;

2017-09-10 19:33:28 677

原创 优先队列实现哈夫曼编码(贪心法)

构造哈夫曼树及输出哈夫曼编码,优先队列构造最小堆实现 Windows下输入结束方法:Enter,Ctrl+Z,Enter运行结果如下: #include <fstream>#include <iostream>#include <queue>#include <algorithm>#include <string>using namespace std;typedef struct t

2017-09-10 12:16:59 3136

原创 priority_queue简单用法

#include <fstream>#include <cstdio>#include <string>#include <algorithm>#include <vector>#include <cstdlib>using namespace std;#define max_char_num 10typedef struct treeNode { int freq; c

2017-09-09 22:18:17 373

原创 矩阵倒置

矩阵转置#include <stdio.h>#include <malloc.h>#pragma warning(disable:4996)int main() { FILE * fin; FILE * fout; fin = fopen("matrixIn.txt", "r"); fout = fopen("matrixOut.txt", "w"); int

2017-09-09 01:50:44 1689

原创 判断是否是素数

判断至i^2<=n时即可 1既不是合数也不是素数#include <cstdlib>#include <iostream>#include <cmath>using namespace std;//判断是否是素数bool isPrimer(int n) { if (n <= 1) return false; int m = floor(sqrt(n) +

2017-09-09 01:48:09 362

原创 进制转换

10进制转2进制,并统计结果中0的个数与1的个数 使用栈实现#include <iostream>#include <stack>#include <string>#include <vector>using namespace std;void change(int n) { stack<int> s; vector<int> v; int temp; s

2017-09-09 01:18:17 196

原创 <algorithm>中的sort()函数

迭代器iterator begin()返回一个iterator 它指向容器的第一个元素 end()返回一个iterator 它指向容器的末元素的下一个位置sort函数:前两个参数是两个指针(记为分别指向元素a和元素b),最后一个参数是一个比较函数,默认比较函数返回值为真时,将a到b之间的数从小到大排列;前两个参数为[a,b),即包含元素a,不包含元素b#include <iostream>#

2017-09-09 00:52:18 543 2

原创 由遍历序列构造二叉树

根据前序中序确定二叉树根据后序中序确定二叉树根据层次中序确定二叉树 注意,根据前序和后序无法确定一棵二叉树#include <iostream>#include <stack>#include <queue>#include <string>#include <cstdlib>#include <fstream>using namespace std;#define ElemTy

2017-09-08 01:33:21 1208

原创 树的递归与非递归遍历(C++读文件)

从“tree.in”文件里读取字符串,构造树,若遇到’0’,则认为是空树,然后对该树进行四种遍历#include <iostream>#include <stack>#include <queue>#include <string>#include <cstdlib>#include <fstream>using namespace std;#define ElemType charty

2017-09-08 00:16:35 422

原创 8种内排序算法(C++实现)

几种基于比较的内排序,C++简单实现,采用array或vector记录序列,升序排列。插入排序:直接插入排序,折半插入排序,希尔排序 交换排序:冒泡排序,快速排序 选择排序:简单选择排序,堆排序(最大堆) 归并排序(二路) /*以一维数组作为待排序文件的组织形式,并假定关键字均为整数,按递增次序讨论排序算法*/#include <iostream>#include <vector>usi

2017-09-07 00:42:34 395

原创 头插法实现链表倒置

首先创建带有头结点的单链表,输入999时,结束//链表倒置#include <stdio.h>#include <malloc.h>typedef struct LNode { LNode * Next; int data;} LNode,* linkList;//头插法创建链表,输入999时结束,先输入的数据出现在后面linkList createList(linkList

2017-09-06 22:43:40 1088

原创 C 文件读写(以判断闰年为例)

从“in.txt”读入数据 ,计算天数,将结果输出至“out.txt”。两文本文件如图 代码如下:#include <stdio.h>#include <stdlib.h>//判断是否是闰年,四年闰,百年不闰,四百年不闰bool isleapyear(int year) { if (((year % 4 == 0) && (year % 100 != 0)) || year % 400

2017-09-04 19:55:15 274

网上商城注册登录模块需求分析(以京东商城为例)

一个文档+一个展示PPT+各种图,包含ER图,类图,时序图,用例图,功能流程图等,Visio格式和图片格式都在里面,武大国软电子商务课程作业

2017-07-25

深入浅出数据分析读书笔记

比较全面的读书笔记,思维导图形式

2017-07-23

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除