博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2016年3月2日

摘要: ///通过队列,找出最小的dis[]值,取出配对的vertex值。 /// stack priority_queue set struct edge { int to; int cost; } ; vector <edge>G[MZX_V];///表 typedef pair<int ,int > 阅读全文

posted @ 2016-03-02 22:27 shaoweiyi 阅读(179) 评论(0) 推荐(0) 编辑

摘要: ///标准的dijkstra算法 void dijkstra() { while(true) { int vert=-1; dis[-1]=INF; for(int i=0;i<num_v;i++) { if( (!used[i]) && ( vert==-1||dis[i]<dis[vert] ) 阅读全文

posted @ 2016-03-02 21:22 shaoweiyi 阅读(235) 评论(0) 推荐(0) 编辑

摘要: ///单源最短路问题 ///DAG:单向不循环图 ///问题的特殊性:要对变进行遍历,而不是顶点 const int MAX_V=; const int MAX_E=; const int INF=; int num_v; int num_e; int start; int aim; struct 阅读全文

posted @ 2016-03-02 20:04 shaoweiyi 阅读(119) 评论(0) 推荐(0) 编辑

摘要: ///图的搜索:两色染色问题 vector<int>G[MAX_V]; color[MAX_V]; bool dfs (int i,int c) { color[i]=c; for(int j=0;i<G[i].size();j++) { if(color[ G[i][j] ]==c) return 阅读全文

posted @ 2016-03-02 18:55 shaoweiyi 阅读(162) 评论(0) 推荐(0) 编辑

摘要: struct vertex { // edge: vector <vertex*> edge; /*vertex的其他属性*/ }; vertex G[max_v]; int main() { int num_e; int num_v; cin>>num_v>>num_e; for(int i=0; 阅读全文

posted @ 2016-03-02 17:44 shaoweiyi 阅读(115) 评论(0) 推荐(0) 编辑

摘要: const int MAX_E=; const int MAX_V=; vector <int> G[MAX_V]; /* 有其他属性的是 struct edge {int to; int cost;}; vector<edge>G[MAX_V]; */ int main() { int num_e 阅读全文

posted @ 2016-03-02 13:37 shaoweiyi 阅读(150) 评论(0) 推荐(0) 编辑

2016年3月1日

摘要: //继承的一般声明: calss A extends SuperA ///接口的一般声明: interface A ///类的声明: {修饰词} class 类名 {} ///类的方法的声明: [修饰词] 返回值 方法名 (参数列表){} ///类的方法的使用: public class Hello 阅读全文

posted @ 2016-03-01 18:32 shaoweiyi 阅读(115) 评论(0) 推荐(0) 编辑

2016年2月29日

摘要: Tip1: JDK Eclipse 开发工具 SDK ADT () 工具包 AVD android模拟器 Tip2: Package :全小写 Project(file) : Class(对象) :每个单词首字母大写 成员:属性&方法(method)除首单词外,每个单词首字母大写 实例:实例化的类, 阅读全文

posted @ 2016-02-29 22:23 shaoweiyi 阅读(142) 评论(0) 推荐(0) 编辑

摘要: ///this的用法 this 用在类内,构造函数或一般函数中 ///当函数内部的变量有和属性相同的变量时 改变的是属性(类内的变量) public class ThisDemo { int number=0; ThisDemo increment(){ number++;/// return th 阅读全文

posted @ 2016-02-29 21:59 shaoweiyi 阅读(182) 评论(0) 推荐(0) 编辑

2016年1月22日

摘要: 来自(百度知道) 留存自看对于基础的掌握的话,两者相对来说差不多。因为都是面向对象的语言,大部分语法都类似。不过,相对来说JAVA更易用,因为JAVA没有指针概念,都是通过java虚拟机完成了内存回收,因此对于编程者来说这个更易用。而C++需要编程人员自己掌握内存的申请和释放,如果掌握不好,就容易出... 阅读全文

posted @ 2016-01-22 21:34 shaoweiyi 阅读(14217) 评论(0) 推荐(0) 编辑