自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 资源 (4)
  • 收藏
  • 关注

原创 杨氏查找矩阵

1 2 53 4 76 8 9从左到右递增,从上到下递增。如果要查找元素应该如何查找。#includeusing namespace std;#define COL 3#define ROW 3bool Young(int a[][COL],int search){ int i =0,j = COL-1; int tmp = a[i][j];

2013-12-30 20:10:09 467

原创 字符串压缩

压缩字段的格式为"字符重复的次数+字符"。例如:字符串"xxxyyyyyyz"压缩后就成为"3x6yz"。要求实现函数:      void stringZip(const char *pInputStr, long lInputLen, char *pOutputStr);    输入pInputStr:  输入字符串lInputLen:  输入字符串长度    输出 pOutp

2013-12-30 19:31:07 1735 1

原创 筛子法求质数

给你一个自然数N,求[6,N]之内的所有素数中,两两之和为偶数的那些偶数。#includeusing namespace std;//筛子法求质数 可以参考亲和数 //6~N的质数,打印两两质数为偶数的所有这些偶数//因为质数除开2以外都是奇数,那么大于6的偶数都是奇数,那么把6~N之间的质数都求出来,打印两两的和就可以了。 int main(){ cout <

2013-12-27 18:31:38 2054 5

原创 丑数

只包含因子2,3,5的数叫丑数,求从小到大顺序的第1500个丑数,例如6,8都是丑数,但14不是。因为它包含因子7。习惯上我们认为1是丑数。思路:丑数肯定是由丑数*2或3或5生成的。由空间换时间的做法。#includeusing namespace std;int Min(int num1,int num2,int num3){ int min=(num1

2013-12-27 17:36:24 480

原创 【Cracking the coding interview】Q1.8(旋转字符串)

Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring

2013-12-23 21:52:04 471

原创 【Cracking the coding interview】Q1.7(矩阵置0)

Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.写一个函数处理一个MxN的矩阵,如果矩阵中某个元素为0,那么把它所在的行和列都置为0.#include #include #include using namespa

2013-12-23 21:44:04 730

原创 【Cracking the coding interview】Q1.6(旋转矩阵)

Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?一张图像表示成NxN的矩阵,图像中每个像素是4个字节,写一个函数把图

2013-12-23 20:21:04 518

原创 【Cracking the coding interview】Q1.5(替换字符串)

Write a method to replace all spaces in a string with ‘%20’.写一个函数,把字符串中所有的空格替换为%20 。

2013-12-23 20:18:20 379

原创 【Cracking the coding interview】Q1.4(变位词)

Write a method to decide if two strings are anagrams or not.写一个函数判断两个字符串是否是变位词。O(n)的算法,声明个数组来统计出现的次数#include #include #include using namespace std;bool isAnagram(string x, string y){

2013-12-23 19:43:23 592

原创 【Cracking the coding interview】Q1.3(移除重复字符)

Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not

2013-12-23 19:18:20 500

原创 【Cracking the coding interview】Q1.2(反转字符串)

原文:Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.)写代码翻转一个C风格的字符串。(C风格的意思是"abcd"需要用5个字符来表示,包含末尾的 结束字符)思

2013-12-23 17:56:48 646

原创 【Cracking the coding interview】Q1.1(字符唯一)

读了Hawstein大神的大作,读书笔记记录之,膜拜大神用,给自己增些知识。Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?实现一个算法来判断一个字符串中的字符是否唯一思路:用最小的数

2013-12-23 17:34:12 672

原创 【高精度求幂】

思路:思路类似大数乘法,因为计算机的double和float都有位数精度限制,所以我们只能转化成字符串来处理,最后结果也用字符串来保存。这是poj的1001题//Memory Time //1232K 0MS #include#includeusing namespace std;const int size=1000; //大数位数void mult(cha

2013-12-17 17:06:56 630

原创 【大数乘法】

大数乘法的思路:用数组或者字符串来实现大数的乘法,因为超出了单个数的存储限制,用字符串或者数组来模拟进位,保存结果#include #include using namespace std;void multiply(const char *a,const char *b); int main(){ string num1,num2; //

2013-12-17 17:04:04 543

原创 【php】下载文件

php下载文件注意:1中文名的转码2._SEVER        3.文件操作<?php //函数说明 //参数说明 $file_name 文件名 // $file_sub_dir "/xxx/xxx/" function down_file($file_name,$file_sub_dir){ //$file_name="小米.jpg"; /

2013-12-16 19:13:09 519

原创 重建二叉树

前序 a b d c e f中序 d b a e c f 重建二叉树,并打印后续 d b e f c a #include #include #define TREELEN 6struct NODE{ NODE* pLeft; NODE* pRight; char chValue; }; void R

2013-12-14 16:36:02 517

原创 [codility]CountMultiplicativePairs

Count the number of pairs (A, B) such that A * B > A + B.More formally, A[I] and B[I] represent C[I] = A[I] + B[I] / 1,000,000.For example, consider the following arrays A and B:

2013-12-13 16:10:42 3867

原创 [codility]MinAbsSumOfTwo

Find the minimal absolute value of a sum of two elements. A[0] = -8 A[1] = 4 A[2] = 5 A[3] =-10 A[4] = 3the function should return |(−8) + 5| = 3.Assume that

2013-12-13 16:06:27 1537

原创 [codility]equi

Find an index in an array such that its prefix sum equals its suffix sum.A[0] + A[1] + ... + A[P−1] = A[P+1] + ... + A[N−2] + A[N−1].A[0] = -7 A[1] = 1 A[2] = 5A[3] = 2 A[4] =

2013-12-13 15:54:26 1069

原创 【双向链表】水浒英雄

双向链表可以解决的问题可以完成自我删除,效率相对高,不需要辅助结点 双向链表完成英雄排行管理 查询英雄 添加英雄 删除英雄 修改英雄 <?php //使用php的面向对象的方式来完成 class Hero{ public $pre=null;//表示指向前一个节点的引用 public $no; public $name;

2013-12-10 11:54:45 568

原创 【栈】实现高级计算器

实现一个计算器9+2*8-230+2*6-17*2-3*5-2 <?php// $exp=$_GET['exp'];// $exp='9+2*8-3'; //[人眼睛3+12-2 =>15-2=>13]// $exp='304+10*6-10'; $exp='71*2-50*3-3-67*6+80';//-333 $numsSta

2013-12-09 23:22:58 605

原创 【栈】数组模拟栈的操作

用php实现的模拟栈的操作 使用数组来模拟栈的各种操作 <?php class MyStack{ private $top=-1;//默认是-1,表示该栈是空的 private $maxSize=5;//$maxSize表示栈的最大容量 private $stack=array(); //注意类里面的变量一定要用$this->xxx,不

2013-12-09 18:13:01 674

原创 【环形链表】丢手帕问题

小朋友丢手帕问题,小朋友的编号(1,2,...,n) ,从k号小朋友开始数,从1开始数到m,当数到m的小朋友出列(1以下是php的环形链表实现方法 约瑟夫问题 <?php class Child{ public $no; public $next=null; public function __construct($no){ $th

2013-12-09 17:17:36 567

原创 【单链表】curd-水浒英雄排行榜

学习了下韩总的算法课,自己记了下笔记,手敲了一下,很有感触。1、单链表的构造2、单链表的添加3、单链表的删除4、单链表的更新 单向链表完成英雄排行管理 查询英雄 添加英雄 删除英雄 修改英雄 <?php class Hero{ public $no;//排名 public $name;//名字 public

2013-12-09 13:19:45 528

原创 memcache学习笔记

Memcached技术介绍:memcached是一种缓存技术, 他可以把你的数据放入内存,从而通过内存访问提速,因为内存最快的, memcached技术的主要目的提速,在memachec 中维护了一张大的hashtable表 ,该表是在内存,表的结构是key    value字串  (字串,数值,数组,对象,布尔,二进制数据,null)原理说明:windows下

2013-12-05 19:02:10 2395

原创 【穷举】5 5 5 5 5=5填入操作符

填入合适的操作符使得 5 5 5 5 5=5可以填入+ - * / 不能添加括号。代码如下#include #include int main(){ char oper[]={' ','+','-','*','/'}; int i[5]; int sign=1,j,count=0; int num[]={0,5,5,5,

2013-12-05 13:03:06 3478

web service经典电子书(全英文)

web service经典电子书(全英文)Prentice Hall PTR - Developing Enterprise Web Services {An Architect's Guide} (Nov 14, 2003).chm

2008-11-14

osworkflow入门范例

使用tomcat mysql使用jdbcStore的范例,我调试了一个星期,因为多了一行中文注释,所以茫然了一个星期,无从下手,昨天经老师指点。终于成功,发上来共享。<br>使用方法:把mine压缩包解压,把osworkflow-2.8.0-example文件夹放入%TOMCAT_HOME%\webapp下。osworkflow-2.8.0-example.xml放在%TOMCAT_HOME%\conf\Catalina\localhost<br>当然数据库要配置连接池,名字为jdbc/oswf。(百度上搜配置方法)<br>在mysql里面创建好数据库。<br>然后就可以直接访问了。

2008-04-12

Eclipse__MyEclipse+Struts+Spring+Hibernate入门例子

入门的例子,简单实用

2008-04-08

空空如也

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

TA关注的人

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