资源列表
快速排序非递归算法(队列实现)
- 快速排序的非递归方法
表达式求值
- 表达式求值
不带头结点的单向链表逆置
- 给定程序中,函数fun的功能是将不带头结点的单向链表逆置,即若原链表中从头到尾结点数据域依次为:2、4、6、8、10,逆置后,从头至尾结点数据域依次为:10、8、6、4、2。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 -A given program, function fun is the function of the node will not take the lead against the home one-way linked list,
这是一个将Dijkstra算法的时间复杂度
- 这是一个将Dijkstra算法的时间复杂度从O(n*n) 优化为O(nlogn)的方法,This method can reduce time complexity from O(n*n) to O(nlogn) for Dijkstra s algorithm.
构造两个带有表头结点的有序单链表
- 构造两个带有表头结点的有序单链表La、Lb,编写程序实现将La、Lb合并成一个有序单链表Lc。-Construct two header node with a single linked list ordered La, Lb, write a program to achieve the La, Lb merged into a single sorted list Lc.
循环单链表基本算法实现
- 循环单链表基本算法实现,如初始化,尾插法,输出,插入,删除等-Circulation single linked list of basic algorithms, such as initialization, the end of interpolation, output, insert, delete, etc.
利用复数的输出方法将结果输出
- 1. 定义一个复数类Complex,该类有代表实部与虚部的成员变量,有两个构造函数Complex()与Complex(int x,int y)分别完成将成员变量初始化为0及给定值,另有计算复数的加减法及输出复数的三个方法,编程序利用该类完成2+3i与6-8i相加,12+9i与20-8i相减,并利用复数的输出方法将结果输出。,Define a complex number class Complex, the class is represented real and imaginary part
cPP 约瑟夫问题
- 1、约瑟夫问题的一种描述是:编号为1,2,3——,n的n个人按顺时针方向围坐一圈, 每个人持有一个密码(正整数)。一开始任选一个正整数作为报数上线值m,从第一 开始按顺时针方向报数,报到m时停止报数。报m的人出列,将他的密码作为新 的 m值,从他在顺时针方向上的下一个人重新开始从1报数,如此下去,直至所有人 全部出列。 2、程序运行后,首先要求用户指定初始报数上限值,然后读取个人的密码。可设n≤30。 3、测试数据:m=20;n=7;密码一次为:3,1
约瑟夫环循环报数链表
- M个人围成一圈,从第一个人开始依次从1到N循环报数,当报到N的时候此人出圈,直到圈中只剩一人为止.要求按退出顺序给出原始编号-M personal circle, starting from the first person in turn reported from 1 to N number of cycles, N, when the report when the person out circle, circle until only one person so far. Requir
常见算法及函数源代码
- 算法设计与分析 1. 用直接递归方法计算n!: (2)通过键盘输入n的值,( 2. 用直接递归方法计算第n个Fibonacci数: 3. 用直接递归方法计算Ackerman函数: 4. 用直接递归方法给出n个元素的全排列: 8. 用直接递归方法求解Hanoi塔问题 ,Algorithm Design and Analysis 1. Using direct recursive meth
用动态规划算法思想求最小编辑距离
- 用动态规划算法思想求最小编辑距离,即近似字符串匹配问题,Thinking of using dynamic programming algorithm for the minimum edit distance, that is, approximate string matching problem
顺序表算法实现,如初始化,尾插法
- 顺序表算法实现,如初始化,尾插法,输出,判断是否为空,插入元素,删除等-Sequence table algorithm, such as initialization, tail interpolation, the output, to determine whether the air, into the element, delete, etc.