Algorithm
Daria·Saira
这个作者很懒,什么都没留下…
展开
-
Prog/Algo_practice_190401
Program/Algorithm_practice 1利用 二分法/dynamic array 实现子列最大和问题//FUNC1//output is only three states : left(A);mid(B);right(C)int max3(int A, int B, int C){ return A>B?A>C?A:C:B>C?B:C;}//find...原创 2019-04-03 17:13:52 · 129 阅读 · 0 评论 -
Struct_Graph
Struct_Graphwhat’s graphlinear list : one-to-onetree : one-to-manygraph : many-to-manylinear list and tree could regard as a special case of graphbasic termsADTexpression of graphadjace...原创 2019-06-05 21:29:22 · 180 阅读 · 0 评论 -
Struct_Huffman tree & Huffman code
Huffman tree & Huffman codeproblem backgroundthe existed questionunder this backgroundif most people’s grades are over the 90,means they have to take a lot of judgement which might be abl...原创 2019-06-01 18:06:32 · 148 阅读 · 0 评论 -
struct_Tree(3)_20190529
struct_Tree(3)_practicequestion : how to distinguish if it’s the same binary search treesolutionmethod 3 : build a search treenotice : flag=1 --> just reading the remaining numbers...原创 2019-05-29 21:26:49 · 193 阅读 · 0 评论 -
Struct_Application example -- Graph
Application example – GraphQuestion 1.descriptionanalysis什么是图的顶点?鳄鱼头,湖岸,孤岛均为题意中抽象的节点图的边表示什么关系?可以从一个顶点跳到另一个顶点solutionthinking: Choose which method to represent the graph?此例中邻接矩阵/邻接表实现...原创 2019-06-18 19:55:08 · 194 阅读 · 0 评论 -
Struct_Set & The operation of set
Set & The operation of setSetconcept双亲表示法 : 孩子指向双亲ADTsearchmerger原创 2019-06-03 21:36:49 · 105 阅读 · 0 评论 -
Struct_Practice_TREE
Practice_TREEQuestion1post : 342651analysis:不知道node的具体顺序但结合 pre & in 可知左子树结点个数(green)及右子树结点个数(蓝)分而治之:实际后序操作:(current :1)树根至于最后对左子树(蓝)递归对右子树(绿)递归//已上图为例,当递归进行到对右子树的右子树调用时,//会出现n==0的...原创 2019-06-19 21:34:03 · 117 阅读 · 0 评论 -
Struct_shortest path algorithm_0620
Shortest path algorithmconcept无权图的单源最短路径算法Single source shortest path algorithm of unweighted graphinitialization : dist[w] 两种作用异常值(+/-∞/-1) : unvisited有效值 : s 到 w 的shortest distance...原创 2019-06-20 18:09:52 · 182 阅读 · 0 评论 -
Python_test8_Robust input_190617
conclusioncomplex()和complex(eval())之间的比较将能够排除非数字类型的输入。注意:不能直接使用eval(),否则,用户可以通过输入表达式(如100**2)输入数字,与要求不同(在实际应用中带来安全隐患)。高危函数eval()try - except / assert#coding:utf-8'''program2.数字的鲁棒输入--------...原创 2019-06-17 18:53:00 · 184 阅读 · 1 评论 -
Struct_Flody_190625
Flodyemmmmmm orz令人头秃,单独拿出来研究一下Q-1AQ当前已经求得最短路径的节点?当前选中D点则不会再有dist[d]被更新(dist[d]=10为a->d最短路径)若存在,由于安照递增次序,该点会在round4被选中而非d点在round4被选中, 反证法可严谨证明...原创 2019-06-25 21:38:57 · 91 阅读 · 0 评论 -
Struct_graph&practice_190705
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Ma...原创 2019-07-05 21:55:42 · 175 阅读 · 0 评论 -
struct_heap
struct_heapneed to review1. heap_conception时间复杂度: T(N) = O( log N )typedef struct HNode *Heap; /* 堆的类型定义 */struct HNode { ElementType *Data; /* 存储元素的数组 */ int Size; /* ...原创 2019-05-30 16:31:45 · 265 阅读 · 0 评论 -
struct_Tree(2)_20190522
Tree (2)BST(binary search tree)ADTFindfind max/min nodeinsertdelete原创 2019-05-22 21:42:39 · 239 阅读 · 0 评论 -
02
#include<stdio.h>#include<stdlib.h>typedef struct{ int maxsum; int first; int end;}form;form online(int list[],int n){ form out; int nowsum=0; int i=0; int maxsum=-1; //two f...原创 2019-05-26 17:40:33 · 90 阅读 · 0 评论 -
Program/Algorithm_practice 1.2
Program/Algorithm_practice 1.2利用 online/dynamic array 解决子列最大和问题key pointscan the array by ordernowsum saves the current answermaxsum always saving the max valueand when nowsum is minus ,drop i...原创 2019-04-08 19:59:35 · 131 阅读 · 0 评论 -
Python_190414_test5
Python_190414_test5program1#计算任意个输入数字的乘积def cmul(*a):#notice the use of changeable value s=1 for i in a: s*=i return s #notice the space signs the layer of the program prin...原创 2019-04-14 19:27:44 · 1157 阅读 · 0 评论 -
汉明码的原理、生成及检验
help text:principle纠错原理汉明码的原理、生成及检验在计算机运行过程中,由于种种原因导致数据在存储过程中可能出现差错,为了能够及时发现错误并且将错误纠正,通常可以将原数据配成汉明编码。汉明码具有一位纠错能力。设将要进行检测的二进制代码为n位,为使其具有纠错能力,需要再加上k位的检测位,组成n+k位的代码。那么,新增加的检测位数k应满足:2k≥n+k+12^k...转载 2019-04-03 19:16:23 · 7203 阅读 · 0 评论 -
C_190418_array
C_190418_arrayerror : variably modified at file scopehelp text 1help text 21、#define LISTEN_NUM 10 /*The MAX Number Of Users*/2、const int LISTEN_NUM = 10;/*UserProfile Struct, to store us...原创 2019-04-18 18:16:23 · 204 阅读 · 0 评论 -
190419_c_test6
/* 题目内容:由于计算机内部表达方式的限制,浮点运算都有精度问题,为了得到高精度的计算结果,就需要自己设计实现方法。(0,1)之间的任何浮点数都可以表达为两个正整数的商,为了表达这样两个数的商,可以将相除的结果以多个整数来表示,每个整数表示结果的一位。即商的第一位用一个整数来表示,第二位用另一个整数来表示,以此类推,就可以输出一个高精度的除法结果了。如16/19的结果0.8421052...原创 2019-04-19 13:13:23 · 160 阅读 · 0 评论 -
C_test7.1(array/pointer)_190505
error analyse & reflect:1.情况分析不周全2.学习参考程序中对"输出(待解决问题)"最小分解后处理,防止对情况不周全考虑题目内容:一个多项式可以表达为x的各次幂与系数乘积的和,比如:2x6+3x5+12x3+6x+20现在,你的程序要读入两个多项式,然后输出这两个多项式的和,也就是把对应的幂上的系数相加然后输出。程序要处理的幂最大为100。输入格式:...原创 2019-05-05 21:34:31 · 104 阅读 · 0 评论 -
C_Polynomial multiplication and addition_190509
Polynomial multiplication and addition – realize by Cnotice : complement the codemathematical modeldata structstruct polynode{ int coef;//系数 int expon;//指数 struct polynode *link;//point to ...原创 2019-05-09 21:02:23 · 205 阅读 · 0 评论 -
Struct_chapter3_Tree
Struct_chapter3_Tree3.1 tree and the expression of treeconcept of treean excellent struct to expresses hierarchical relationship(层次关系)more efficienctSearching0x01 static searchingnotice :...原创 2019-05-14 21:43:26 · 386 阅读 · 0 评论 -
C_Euclidean algorithm
最简分式(10分)题目内容:分数可以表示为“分子/分母”的形式。编写一个程序,要求用户输入一个分数,然后将其约分为最简分式。最简分式是指分子和分母不具有可以约分的成分了。如6/12可以被约分为1/2。当分子大于分母时,不需要表达为整数又分数的形式,即11/8还是11/8;而当分子分母相等时,仍然表达为1/1的分数形式。输入格式:输入在一行中给出一个分数,分子和分母中间以斜杠“/”分隔,如:...原创 2019-05-22 15:50:34 · 115 阅读 · 0 评论 -
Struct_graph&MST_190706
Struct_graph&MSTMSTAttribute of MSTMSTSolutionGreedy algorithmPrime<=nlognPrim算法中的dist[V]应该初始化为E(s,V)(weight–存在临接关系) 或 正无穷(无临接边)认为每一个点均为一颗树(森林),通过收容weight最小边将多棵树(森林)连接...原创 2019-07-06 17:47:54 · 130 阅读 · 0 评论