自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(154)
  • 资源 (1)
  • 收藏
  • 关注

原创 使用自定义注解向servlet注入spring bean

代理servlet实现向servlet注入spring bean真的好麻烦,所以我们选择注解实现自动注入,但是不禁又想了想,既然spring可以通过扫描属性注解来自动注入spring bean,那么我们自己定义注解扫描是不是也可以呢?

2017-05-07 09:54:52 2175

原创 分治策略求解子数组最大并返回下标

//寻找最大子数组的和,分成三种情况来讨论/*在数组A[low...high]中,任何连续子数组A[i...j]的位置有三种一、完全位于数组A[low...mid]中,因此low<=i<=j<=mid二、完全位于数组A[mid+1...high]中,因此mid<i<=j<=mid三、跨越了中点,因此low<=i<=mid<j<=high*/class FindMaxSubarray

2017-04-09 11:53:22 339

转载 Nodejs创建Express4项目以及使用Visual Studio Code编辑器配置Nodejs开发环境

https://code.visualstudio.com/Docs/runtimes/nodejs

2016-07-10 17:30:49 686

原创 设计模式目录

设计模式学习目录目录设计模式中类的关系

2015-12-26 19:01:40 335

转载 设计模式之------设计模式中类的关系

设计模式中类的关系这篇文章转自快课网 http://www.cricode.com/1405.html在Java及其他面向对象的设计模式中,类与类之间的关系主要有6中关系: - 依赖(Dependence) - 关联(Association) - 聚合(Aggregation) - 组合(Composition) - 继承(Generalization) - 实现(Implemen

2015-05-25 23:44:47 384

原创 分治法解决最大子数组问题

利用分治法解决最大子数组问题(对给定的数组得到该数组中具有最大和的子数组)/* * 对于给定的整数数组A,求出数组中具有最大和的子数组,最大和以及左右下标 * 思路:采用分治的方法,将数组分为两部分,则有最大和的子数组共有三种情况 * 在数组左边,在数组右边,跨越数组中点 */#include <iostream>using namespace std;//存放左右边界值以及sum值的结构

2015-04-16 00:06:31 1684 1

Java并发(多线程)学习总结

1、程序在结构上,程序是数据结构加算法再加上相应代码构成的,但是在计算机中程序是以文件形式保存在磁盘等存储器中,说白了就是01串,尚未启动的程序就是个文件,和视频音频文件没有多少区别。比如电脑中的一个单机游戏(解压直接运行) 整个文件夹内的内容就是一个程序 2、进程进程是指执行中的程序,计算机中每个进程由操作系统分配相应的系统资源执行,进程是系统资源分配的基本单位我在...

2015-02-02 10:26:16 184

原创 二叉搜索树基本功能实现

/*二叉搜索树中的节点类 *Node.h */# ifndef _NODE_#define _NODE_class Node{private: int value;/*节点中存放的元素值*/ Node *parentNode;/*所指向的父节点指针*/ Node *leftChildNode;/*左孩子节点指针*/ Node *rightChildNode;/*右孩子节点指针

2014-11-05 13:31:14 476

原创 计算带括号的四则运算表达式

/**Node.java * 字符栈的节点类 */package 四则运算带括号;public class Node { private char charElem; private int intElem; private Node next; public Node(){//初始化 this.next=null; this.charElem=' '; } publ

2014-10-18 20:53:46 1076

原创 动态规划_钢条切割最优策略

/* *钢条切割问题:给定一段长度为n英寸的钢条和一个价格表pi(i=1,2,...) *(表示长度为1英寸2英寸...的钢条价格)求切割方案,使得销售收益r最大。 *注意:如果长度为n英寸的钢条价格p[n]足够大,最优解可能就是完全不需要切割 */#include using namespace std;#define MAXLENGTH 10//钢条最大长度int rArr

2014-09-26 15:37:20 1202 3

原创 类模版

//Stack.h#ifndef _STACK_H_#define _STACK_H_templateclass Stack{private: int size;//栈中元素个数 int top;//栈顶元素位置 T *stackPtr;public: Stack(int = 10); ~Stack() { delete [] stackPtr; } bool

2014-09-23 10:08:13 347

原创 函数模版

#include using namespace std;template //等价于template void printArray(const T* tempArray,int count){ for(int i=0;i<count;i++) { cout << " " << tempArray[i]; if((i+1)%15==0) cout << endl; }

2014-09-23 10:05:40 338

原创 基数排序

//基数排序#include #include #include #include #define KEYNUMBER 3//整型数的位数#define RADIX 10//每位数字从0到9共有九个#define NUMBER 100using namespace std;int getNumInPos(int,int);void radixSort(int *,int);

2014-09-07 19:45:44 352

原创 计数排序

/*计数排序就是在n个数(均小于某一个值k)利用k来进行排序,不涉及到元素之间的比较*/#include #include #include #include #define NUMBER 1000 //数组中元素的范围#define ARRAYLENGTH 1000 using namespace std;void countingSort(const int *,i

2014-09-02 21:25:56 341

原创 快速排序的随机化版本

//就是从p到r之间产生一个随机数,i将A[i]和A[r]交换就行#include #include #include #define NUMBER 20using namespace std;int random(int p,int r);//产生p到r之间的随机数int partition(int *sPtr,int p,int r);//将数组进行划分int randomi

2014-09-01 21:09:45 533

原创 双向链表的实现

#include "Node.h"#include using namespace std;class LinkedList{private: int listLength;//链表长度 bool isEmpty;//记录链表是否为空表 Node *headNode;public: LinkedList();//构造函数 int getListLength(){return

2014-08-31 15:51:23 465

原创 快速排序

//quickSort.cpp/*快速排序用到分治思想,为原址排序,不需要进行merge操作第一步:分解:数组A[p...r]被划分为两个子数组A[p...q]和A[q+1...r],使得A[p...q-1]中元素均小于A[r],A[q+1...r]中元素均大于等于A[r]第二步:解决:通过递归调用快速排序,对子数组A[p...q-1]和A[q+1...r]进行排序第三步:合并:因为子

2014-08-28 22:46:39 337

原创 堆排序_最大优先队列

//maxPriorityQueue.cpp//优先队列支持的操作:insert ,maximum,extract,increaseKey,#include #include #include #define NUMBER 100#define NUM 6using namespace std;struct heapType{ int heapArray[NUMBER];

2014-08-28 12:47:18 334

原创 堆排序

//heapSort.cpp#include #include #include #define NUMBER 9using namespace std;struct heapType{ int heapArray[NUMBER+1];//数组中存放20个元素,从1到20; int arraySize;//数组长度 int heapSize;//建的堆中元素个数};v

2014-08-28 10:22:58 372

原创 70_可变数目变元

//_70_可变数目变元//_70_main.cpp//感觉无意义

2014-08-15 09:01:40 389

原创 69_伪随机数的生成

//_69_伪随机数的生成//_69_main.cpp//用系统时间通过使用srand()和rand()函数随机的初始化rand()函数//两个函数包含在中#include #include #include int main(){ long time1 = time(NULL);//返回系统当前时间 printf("%ld\n",time1); int time2 =

2014-08-15 08:58:49 405

原创 68_排序函数

//_68_排序函数//_68_main.cpp#include #include int num[12]={14,5,9,7,6,0,91,4,1,3,2,8};int comp(const void *,const void *);int main(){ printf("Original array: "); for(int i=0;i<12;i++) printf

2014-08-15 08:58:40 357

原创 67_跳转函数

//_67_跳转函数//_67_main.cpp#include #include #include jmp_buf ebuf;//类型在中定义void fun();int main(){ int i; printf("1 "); i = setjmp(ebuf);//返回值0; if(i==0) { fun();//为什么下一句不会被打印呢 printf(

2014-08-15 08:58:05 382

原创 66_查找函数

//_66_查找函数//_66_main.cpp#include #include #include char *alpha = "abcdefghijklmnopqrstuvwxyz";int comp(const void *ch,const void *s);int main(){ printf("Enter a character: "); char ch=get

2014-08-15 08:57:10 296

原创 65_转换函数

//_65_转换函数//_65_main.cpp/*在头文件中将str指向的串转换成双精度浮点值、整型值、长整型值串中必须含有合法的xxxxxx、xxx、xxxx,一一对应double atof(const char *str);int atoi(const char *str);long int atol(const char *str);*/#include #incl

2014-08-15 08:56:25 381

原创 64_常用时间函数

//_64_常用时间函数//_64_main.cpp#include #include #include int main(){ struct tm *local; time_t tm;//定义time_t类型的变量 tm = time(NULL); local = localtime(&tm); printf("Local time and date: %s\n",as

2014-08-15 08:55:46 362

原创 62_综合实例

//_62_综合实例//_62_main.cpp//简单的通讯录程序#include #include #define MAX 100struct adress{ char name[20]; char street[40]; char city[10]; char state[4]; unsigned long zip;}addr_list[MAX];void

2014-08-15 08:53:32 433

原创 63_动态分配函数

//_63_动态分配函数//_63_main.cpp//void *malloc(size_t size)//向系统申请内存空间//void free(void *ptr)//释放内存空间#include #include #define NUMBER 5int main(){ //定义一个字符型的指针数组 char *str[NUMBER]; int t; //为数组

2014-08-15 08:53:02 370

原创 61_错误处理

//_61_错误处理//_61_main.cpp#include #include #define TAB_NUM 8#define IN 0#define OUT 1void error(int e){ if(e==IN) printf("输入错误:\n"); else printf("输出错误:\n"); //exit(1);//跳出程序}//为了使用该

2014-08-15 08:52:51 455

原创 60_随机存取

//_60_随机存取//_60_main.cpp//原点origin的宏://SEEK_SET 0//SEEK_CUR 1//SEEK_END 2//int seek(FILE *fp,long int numberbytes,int origin)//以原点为基点,向前移动numberbytes个字节,#include #include int main(int a

2014-08-15 08:52:06 371

原创 59_fprintf()和fscanf()

//_59_fprintf()和fscanf()//_59_main.cpp#include #include #include int main(){ FILE *fp; char str[80],str1[80]; int i,j; if((fp=fopen("text.txt","w"))==NULL)//以写入的方式打开 { printf("Can not o

2014-08-15 08:51:31 316

原创 58_fread()和fwrite()

//_58_fread()和fwrite()//_58_main.cpp//用于向文件中读写长于一个字节的数据类型#include #include int main(){ FILE *fp; int i = 156; long l = 9701076l; double d = 3.456; if((fp=fopen("test.txt","w"))==NULL) {

2014-08-15 08:51:00 352

原创 57_函数rewind()

//_57_函数rewind()//_57_main.cpp//void rewind(FILE *fp)重置文件位置,将其置到函数变元所指定的文件的开头#include #include #include int main(){ char str[80]; FILE *fp;//定义一个文件类型的指针 //以写的方式打开文件file if((fp=fopen("fil

2014-08-15 08:50:25 423

原创 54_格式化输入函数

//_54_格式化输入函数//_54_main.cpp#include #include int main(){ int i,j,k; char str[80]; char *p; //输入的数分别以十进制、八进制、和十六进制读入程序 scanf("%d %o %x",&i,&j,&k); printf("%d,%d,%d\n\n",i,j,k);//查看实际输入的数据,

2014-08-15 08:48:34 358

原创 56_fputc()和fgetc()

//_56_fputc()和fgetc()//_56_main.cpp#include #include #include #include int main(){ FILE *fp;//文件指针变量 char str[100]; fp=fopen("file.txt","w");//!!!!!!!!!!是w不是r了记得 if(fp==NULL) { printf(

2014-08-15 08:48:00 325

原创 52_读写字符串

//_52_读写字符串//_52_main.cpp/*用于读写字符串的函数是gets()和puts(),这两个函数允许程序从控制台 读写字符串*///程序原题:让用户输入一个字,然后在内部数据库中查找它,如果发生匹配//程序便打印出该字的意义,否自,指出该字不在字典中//A simple dictionary#include #include #include #in

2014-08-15 08:47:27 376

原创 55_打开和关闭文件

//_55_打开和关闭文件//_55_main.cpp//fopen(),fclose()#include #include int main(){ //定义一个文件指针 FILE *fp; char ch,filename[10]; printf("Please input the name of file:"); scanf("%s",filename);//输入字

2014-08-15 08:47:22 411

原创 51_读写字符

//_51_读写字符//_51_main.cpp//getchar()从键盘读入一个字符、//putchar()向显示屏显示一个字符/*getchar()的原始形式中,输入先被缓冲,直到键入回车时才返回*/#include #include #include int main(){ char ch; printf("Please enter some text(in

2014-08-15 08:46:47 323

原创 50_枚举类型

//_50_枚举类型//_50_main.cpp//枚举符号本质上是整数值,而不是字符串//实例:从多种不同颜色的铅笔中抽出三根,并输出颜色#include #include int main(){ //默认blue=0,red=1,yellow=2。。。。black=4; enum color{blue,red,yellow,purple,black}; int to

2014-08-15 08:46:10 309

原创 53_格式化输出函数

//_53_格式化输出函数//_53_main.cpp#include #include int main(){ unsigned number; double item = 1.23456; for(number=8;number<16;number++) { printf("%3d ",number); printf("%3o ",number);//以八进制格式

2014-08-15 08:46:06 335

FlappyBird源码+图片资源(java实现)

FlappyBird的Java SE实现版本,源代码注释较详细,基本上是采用MVC模型进行开发设计

2015-12-12

空空如也

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

TA关注的人

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