自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 01背包问题中常数优化(背包九讲)

for i=1..N for v=V..0可以改成for i=1..n bound=max{V-sum{c[i..n]},c[i]}for v=V..bound倒推 f(v) 需求出f(v-w(n)) 往后推 f(v-w(n)) 需求出f(v-w(n)-w(n-1)) 继续往后推 则推到第j步 为v-sum(w[j-n]

2015-05-08 23:12:27 2501 3

原创 B树实现

#include#include#define M 3//2-3b树的实现 3阶b树 typedef struct btree{ int count;//结点中元素个数 即关键字个数 int element[M-1]; struct btree* next[M]; bool isLeaf;//增加一个是否是叶子结点判断 }*Btree; //打印void print(Bt

2015-04-07 07:42:19 423

原创 伸展树实现

#include#include//伸展树的实现 typedef struct splayNode{ int element; struct splayNode* left; struct splayNode* right;}*SplayTree;SplayTree SingleTotateWithLeft(SplayTree T);SplayTree SingleTotateW

2015-04-05 21:14:30 327

原创 avl树实现

#include#include//平衡树的实现typedef struct AvlNode{ int element; struct AvlNode *left; struct AvlNode *right; int height;}*AvlTree;int Height(AvlTree T){ if(T==NULL){ return -1; }else{

2015-04-05 14:25:25 315

原创 单链表反转

#include#includeint count=0;typedef struct node{ int value; struct node *next;}*Node;//尾插void insert(int value,Node head){ Node p=head; while(p->next){ p=p->next; } Node temp=(Node)mallo

2015-04-02 14:32:41 310

原创 约瑟夫环

#include#includetypedef struct node{ int rank; struct node* next;}*Node;//遍历void print(Node head){ Node temp=head->next; while(temp){ printf("%d ",temp->rank); temp=temp->next; }} //

2015-04-01 18:07:28 282

原创 栈的应用(括号匹配、后缀表式计算、中缀转后缀)

#ifndef _Stack_hstruct Node;typedef struct Node *PtrToNode;typedef PtrToNode Stack;typedef float ElementType;int IsEmpty(Stack s);Stack CreateStack(void);void DisposeStack(Stack s);void Make

2015-03-26 15:38:04 405

原创 主元素问题

#include//快排int quickSort(int a[],int low,int high){ //int low=0,high=len-1; int pivotkey=a[low]; while(low<high){ while(low<high&&a[high]<=pivotkey) --high; a[low]=a[high]; while(low=piv

2015-03-23 17:25:38 334

原创 最大子序列乘积

#include//最大子序列乘积  int maxNum(int a,int b,int c){  int max=a;if(b>max){  max=b;  }if(c>max){  max=c;  }  return max; } int minNum(int a,int b,int c){  int min=a;  if(min>

2015-03-22 16:20:19 455

原创 最小正子序列和

#include//求最小正子序列和//最小正子序列和:1、连续子序列,2、序列和为正且最小 //思路:求出开始的一组子序列:{-2},{-2,11},//{-2,11,-4}, {-2,11,-4,13},{-2,11,-4,13,-5},{-2,11,-4,13,-5,-2} //剩下的子序列必然可以通过上面的这一组子序列相减获得//所以要获得最小正子序列各,必然将上面的序列和排序

2015-03-22 12:29:35 2393 2

原创 最大子序列和问题

#include#include//求最大子序列和问题 //解法四 无法获取位置void getMax5(int a[],int len){ int max=0,result=0; for(int i=0;i<len;i++){ result+=a[i]; if(max<result){ max=result; }else if(result<0){ re

2015-03-21 17:10:53 349

转载 循环打开头文件

#include #include #include #include#include#define MAXLINE 1024void process_line(const char *filename);int main(int argc,char **argv){ process_line("string.h");}void process_line(con

2015-03-21 08:44:30 435

原创 io打印整数实数

#include#include//打印任意整数 void printDigit(int count){ if(count>0){ if(count>10){ printDigit(count/10); } //else { printf("%d",count%10); } }else{ count=0-count; printf("-");

2015-03-21 07:34:23 554

原创 选择问题

#include#include//选择问题解法 //打印数组void print(int *a,int len){ for(int i=0;i<len;i++){ printf("%d ",*(a+i)); }} //交换两个数void swap(int *a,int *b){ int temp=*a; *a=*b; *b=temp;} //冒泡void

2015-03-20 22:41:15 453

转载 java实现视频转码

public class ConvertVideo { /** * @param args */ //private final static String PATH="c:\\ffmpeg\\input\\test.avi"; private static String inputPath=""; private static String outputPath=""; pr

2015-01-06 20:03:27 1513

原创 javaweb下载

public class DownloadCl extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/h

2015-01-05 17:02:34 484

原创 javaweb上传

用到的jar包 comm.io-2.4 commons-fileupload-1.3package com.hwj.model;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.PrintWr

2015-01-05 16:53:14 400

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除