- 博客(9)
- 收藏
- 关注
转载 Kruskal算法求最短路径
//// Graph.hpp// lanqiaobei//// Created by 蒋豪博 on 2017/3/14.// Copyright © 2017年 蒋豪博. All rights reserved.//#ifndef Graph_hpp#define Graph_hpp#define NUM 20#include &l...
2017-03-14 16:24:00 715
转载 c++小知识点
1.定义m*m的数组。int m,**p;p=new int*[m];2.定义n*m的数组int n;int (*p)[2] = new int [n][2];//此处的2不能是变量3.定义n*m的二维数组float **tt = new float*[n];for (int i=0; i<n; ++i) tt[i] = new float[m];转载于:https://www...
2017-03-12 16:42:00 60
转载 各种排序代码总结(待续)
未完待续啊~1、直接插入排序void Sort::InsertSort(){ for(int i=2;i<=length;i++){ int j; sstable[0]=sstable[i]; for(j=i-1;sstable[0].key<sstable[j].key;j--){ ...
2017-03-04 18:39:00 72
转载 迪杰斯特拉(Dijkstra)算法求最短路径
我用的是邻接矩阵来存储图的。代码如下:void Graph:: Dijkstra(){ struct DijNode{ int index; int distance; vector<string> path; bool Founded; //判定是否找到了... };...
2017-03-04 10:01:00 199
转载 回溯法-四皇后问题
//// main.cpp// shuyuerchashu//// Created by 蒋豪博 on 2017/2/26.// Copyright © 2017年 蒋豪博. All rights reserved.//#include <iostream>#include <vector>using names...
2017-02-27 00:58:00 206
转载 回溯法-生成幂集
#include <iostream>#include <vector>using namespace std;void GetPowerSet(vector<int> s,int i,int n,vector<vector<int>> &result,vector<int>&t)...
2017-02-26 23:38:00 198
转载 vector的初始化和遍历
直接见网址:http://blog.csdn.net/u011543018/article/details/50724883很受用...PS:1、 vector<string> temp; temp=vector<string> {"4"}; cout<<temp[0];输出的就是4,在直接函数传vec...
2017-02-26 23:12:00 41
转载 改进的KMP算法的执行过程
比如有模式串 t="aaaabaac"首先我们至少光看的话,发现未修正的next数组是很好列出来的是next:0,1,2,3,4,1,2,3在这个基础上我们可以很容易的写出修正好的nextVal数组:设nextVal[1]=0;(1)i=2,看next[i]=next[2]=1=j,因为t[i]==t[j]即t[2]==t[1],所以nextVal[2]=next...
2017-02-26 13:27:00 111
转载 c++关于输入知识点
1、在string 类型想要输入整行的(带空格)的字符串,getline(cin,str)即可;2、char str[100] 想要输入整行的(带空格)的字符串,cin.getline(str,100)即可3、c=getchar();就是将输入的连带'\n'全部赋值给c while((c=getchar())!='\n'){...}这样就可以连续输入东西,然后以回车结...
2017-02-25 22:35:00 65
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人