![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
u010969626
这个作者很懒,什么都没留下…
展开
-
Java求最小值
Java求最小值 import java.io.IOException; import java.util.Scanner;public class Main { public static void main(String[] args) throws IOException { Scanner in=new Scanner(System.i...原创 2020-04-18 19:31:27 · 2688 阅读 · 0 评论 -
堆排序 heapsort
#include <iostream> using namespace std; void heapify(int arr[], int n, int i) { int largest = i;int l = 2*i + 1;int r = 2*i + 2;if (l < n &...原创 2019-12-31 22:05:00 · 132 阅读 · 0 评论 -
全排列算法的实现(纠正“啊哈”算法书籍中的错误)
本程序在VS2013下调试通过,若有疑问可以评论大家探讨// DFS.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include<stdio.h>#include<stdlib.h>using namespace std;int a[10], book[10], n;void原创 2015-09-19 22:20:06 · 2027 阅读 · 2 评论 -
动态规划之钢条切割问题自底向上发的实现(算法导论第15章)
看算法导论的同学应该知道第15章在讲动态规划,以钢条切割问题作为引论,那么钢条切割问题实际的C代码是怎么实现的呢?图表和题目我就不叙述了,直接看代码// steercut.cpp : Defines the entry point for the console application.//// 钢条切割问题.cpp : Defines the entry point for the consol原创 2016-05-17 20:22:37 · 718 阅读 · 0 评论 -
算法导论第15章15.2-2
MATRIX-CHAIN-ORDER得到的表s中存储的数值就是子问题中的分割点k。MATRIX-CHAIN-MULTIPLY(A,s,i,j) if i=j return 0 else k=s[i,j] return (MATRIX-CHAIN-MUTIPLY(A,s,i,k)+MATR原创 2017-02-07 10:46:34 · 925 阅读 · 0 评论 -
括号匹配问题1153
#include "stdafx.h"#include #include #includeusing namespace std;stack s;char str[100];char ans[110];int _tmain(int argc, _TCHAR* argv[]){while (cin >> str){int i;原创 2017-04-30 19:53:13 · 301 阅读 · 0 评论