- 算法分类合集
weixin_30784945
算法分类合集ACM所有算法数据结构栈,队列,链表哈希表,哈希数组堆,优先队列双端队列可并堆左偏堆二叉查找树Treap伸展树并查集集合计数问题二分图的识别平衡二叉树二叉排序树线段树一维线段树二维线段树树状数组一维树状数组N维树状数组字典树后缀数组,后缀树块状链表哈夫曼树桶,跳跃表Trie树(静态建树、动态建树)AC自动机LCA和RMQ问题KMP算法图论基本图算法图广度优先遍历深度优先遍历拓扑排序割边
- ACM算法分类(要学习的东西还很多)
还是太年轻
ACM所有算法数据结构栈,队列,链表哈希表,哈希数组堆,优先队列双端队列可并堆左偏堆二叉查找树Treap伸展树并查集集合计数问题二分图的识别平衡二叉树二叉排序树线段树一维线段树二维线段树树状数组一维树状数组N维树状数组字典树后缀数组,后缀树块状链表哈夫曼树桶,跳跃表Trie树(静态建树、动态建树)AC自动机LCA和RMQ问题KMP算法图论基本图算法图广度优先遍历深度优先遍历拓扑排序割边割点强连通分
- ACM算法目录
龍木
ACM所有算法数据结构栈,队列,链表哈希表,哈希数组堆,优先队列双端队列可并堆左偏堆二叉查找树Treap伸展树并查集集合计数问题二分图的识别平衡二叉树二叉排序树线段树一维线段树二维线段树树状数组一维树状数组N维树状数组字典树后缀数组,后缀树块状链表哈夫曼树桶,跳跃表Trie树(静态建树、动态建树)AC自动机LCA和RMQ问题KMP算法图论基本图算法图广度优先遍历深度优先遍历拓扑排序割边割点强连通分
- 2024.1.31力扣每日一题——找出不同元素数目差数组
菜菜的小彭
力扣每日一题javaleetcode算法java
2024.1.31题目来源我的题解方法一哈希表+前后缀题目来源力扣每日一题;题序:2670我的题解方法一哈希表+前后缀从左到右计算前缀数组pre[i]表示nums[0,i]的不同元素个数;从右到左计算后缀suff[i]表示nums(i,nums.length]的不同元素个数;结果数组:pre[i]-suff[i]。由于后续的后缀数组和结果数组可以复用前面的前缀数组,所以只需要定义一个数组时间复杂度
- 欣赏一个人,始于颜值,合于性格,敬于才华,久于善良,终于人品
祝你一生自由
有人说:一个人从表到里,可以分为五个层次:外貌,能力,脾气,品格,品性。五个层次如果用品质来衡量,则是:颜值,才华,性格,善良,人品。这五个层次,五种品质,既是判断一个人的最好基准,同时也是一个人修行成长的努力方向。欣赏一个人,始于颜值,敬于才华,合于性格,久于善良,终于人品。始于颜值爱美之心,人皆有之。一个人仪容整洁,令人倍感亲和,如沐春风;与邋遢、不修边幅的人相处,眼观鼻,鼻观心,只想避而远之
- 人的五个层次
Lisa_7247
有人说,一个人从表到里,可以分为五个层次:外貌,能力,脾气,品格,品性。五个层次如果用品质来衡量,则是:颜值,才华,性格,善良,人品。这五个层次,五种品质,既是判断一个人的最好基准,同时也是一个人修行成长的努力方向。欣赏一个人,始于颜值,敬于才华,合于性格,久于善良,终于人品。始于颜值爱美之心,人皆有之。一个人仪容整洁,令人倍感亲和,如沐春风;与邋遢、不修边幅的人相处,眼观鼻,鼻观心,只想避而远之
- 个人修行:禅修
吾宗老孙子
在个人修行里,我的法门主要就是禅宗的法门。六祖说:我此法门,以无念为宗,以无相为体,以无住为本,无念者于念而无念,无相者于相而无相,无住者人之本性。这个法门同样也与老子的法门相通,因为老子的法门是“致虚极,守静笃,万物并作,吾以观复”。同样也与释迦摩尼的法门相通,金刚经讲无相布施,讲无所住而生其心。在修行禅宗法门的时候,我是同时处在本性的状态下,在察觉着一切,却又无所执着。禅宗法门的特别之处,就在
- 为《易效能》写的一封家书
性感牛奶
天棂子于2016年11月6日凌晨致同修:本已闲云野鹤一枚,不想多说什么,功到自然成,全凭个人修行。寥寥几言,有心者悟。缘起:因为机缘巧合接触《易效能》,决定进入绝对不是盲从,世间万物皆有规律,闻道有先后,术业有专攻,叶老师能窥其一斑,绝非常人,能广而告之,是吾等之喜。其中道理,学艺未精,还不敢妄自微薄评论之。但从其适之,必正道也。希望各位同修,在三月中能正其心,从其行,言之语,方可得之精髓。修业:
- 91 . B. Queue (灵茶每日一题 : 01-23)
ros275229
算法学习灵茶CFc++灵茶codeforces
链接:Problem-B-Codeforces思路:预处理后缀数组,存后面最小的值;然后二分;代码:#include#defineIOSios::sync_with_stdio(0);cin.tie(0);cout.tie(0);#defineendl'\n'#definelowbit(x)(x&(-x))#definesz(a)(int)a.size()#definepbpush_back#de
- 超级简单的后缀数组(SA)!!
一棵油菜花
算法篇笔记c++算法
更好的食用体验超级简单的后缀数组(SA)!!前言这里选择当一手标题党。由于刚学完这个字符串算法,本人字符串算法又比较薄弱,好不容易这一次在晚修看各种资料看得七七八八,决定趁脑子清醒的时候记录下来。免得自己不久后忘了后又要痛苦地再看各种资料。希望这篇博客能帮到你。前置知识:RMQ问题、基数排序、lcp问题使用指南:在抽象的时候,可以选择先不看证明;先记住结论,顺一遍后再返回来补证明也是可以的。如果有
- 因果实例(3~5)
随风合道
(3)老头外遇的前因有一位六十多岁的老太,也是位有天眼的修行者,发现老头有了外遇,心里想不通,气了一身病。我告诉她“你用你的追眼功,看一下过去的事就不生气了”。她用追眼看到了前世的事:前世她就是一位很执着的修行者,并与今生的老公就是两口,但那时她是男的,她老公是女的,由于他经常外出只顾个人修行,他老婆在家寂寞,偶尔与一男人发生过关系,这是前世的因。今生到了六十多岁,她老公恰恰又与前世的那个男人(今
- 蓝桥杯每日一题---基数排序
花落yu
蓝桥杯职场和发展
题目分析在实际的比赛过程中很少会自己手写排序,顶多是定义一下排序规则。之所以要练习一下基数排序,是因为在后续学习过程中学到后缀数组时需要自己手写基数排序,那么这里使用的方法也和后缀数组一致,理解这里也便于后缀数组的学习。桶排序全流程回顾原数组:123426123147根据第一关键字即个位数放桶2号桶:123号桶:1234号桶:34146号桶:267号桶:7根据关键字实现一轮排序1212334142
- [acm算法学习] 后缀数组SA
Waldeinsamkeit41
学习
学习自B站up主kouylan定义后缀是包含最后个字母的子串把字符串str的所有后缀按字典排序,sa[i]表示排名为i的后缀的开头下标如何求解SA倍增的方法先把每个位置开始的长度为1的子串排序,在此基础上再把长度为2的子串排序(长度为2的子串就是前面算过的长度为1的子串再加上后面的一位,第i位的和i+1),再把长度为4,8,16,32...(两个两个拼)直到串的末尾,也就是排到了后缀。如何从2^(
- 《易经》智慧:境界无上限,道德有底线
逍姚苍狼
《易经》有六十四卦,第六十三卦是既济,表示已经完成,但是事物不可能穷尽,所以接下来的最后一卦是未济,表示还没有最终完成。有人说,人生有三种境界:最低境界是平凡,其次是超凡脱俗,最高境界是返璞归真后的淡然。也有人把人生分为四个等级,依次是自然境界、功利境界、道德境界、天地境界。境界是可以无限提升的,越往上走,看到的天地越宽,风景越美,直到不可思议!在佛家看来,一个人修行,越修行越没有境界,越修行越平
- 2019-06-16
七书_d6aa
关于“三观”,知乎上有999个讨论。对于三观不同的两个人能不能做朋友,三观不同的情侣会不会走到最后,也有很多人热议。大部分人认为,三观不同,不能相融。还有一个这样的答案:图片发自App我还是觉得,所谓的三观不同,是对于和自己不同的事物言论的容忍度的问题,是个人修行,问题不大!别动不动就把三观搬出来吓人,毕竟,谁能明确地阐述出自己的三观呢?曾经接触到这样一位同学,对于他不认同的观点,他否定;对于他不
- 工作,是最好的修行
一直成长的苹果树
我渐渐觉得,人生就是一个无处不修行的过程。修行,反而不一定要在寺庙里,真正的修行是对人性的修炼,那么,就要在真实生活中来历练,比如,一个坏人要通过修行变成好人,天天在寺庙里吃斋念佛,修的出来吗?修不出来,只有在人间遭遇各种悲惨、救赎,才能悟道,才能变好。对成长中的年轻人来说,工作就是最好的修行。01、匠人精神为什么说工作是最好的修行?因为工作中要遇到各种个问题,而解决问题的过程就是个人修行的过程。
- 【LeetCode:2866. 美丽塔 II | 单调栈 + 前后缀数组】
硕风和炜
LeetCode每日一题打卡leetcode算法java单调栈前缀后缀数组数据结构
算法题算法刷题专栏|面试必备算法|面试高频算法越难的东西,越要努力坚持,因为它具有很高的价值,算法就是这样✨作者简介:硕风和炜,CSDN-Java领域新星创作者,保研|国家奖学金|高中学习JAVA|大学完善JAVA开发技术栈|面试刷题|面经八股文|经验分享|好用的网站工具分享恭喜你发现一枚宝藏博主,赶快收入囊中吧人生如棋,我愿为卒,行动虽慢,可谁曾见我后退一步?算法题目录题目链接⛲题目描述求解思路
- 042蜡笔小猫儿《设计思维——如何从0到1到666提升作品美感》
猫悟空
设计思维主要由五个思维方式构成,且互相渗透,不孤立存在,即目标思维、气场思维、层解思维、合作思维和留白思维。总体来讲,一个好的设计,要明确海报宣传的是什么,与委托方主动交流达成一致,目标思维贯穿整个设计过程;要营造好氛围,找好合适的背景图,图文并茂,形成最佳气场,如个人修行一般,要言行一致;分是为了更好的合,层解思维和合作思维互相扶持,围绕目标,拆解并整合元素互相配合为目标服务;注意留白,像演讲中
- 牛客练习赛87题解
successzjl23
牛客
A思维题当k=n−1k=n-1k=n−1的时候特判一下就行了回超intintint开longlonglonglonglonglongB思维题找一个数组存一下x左右两边比x小的数有多少个前缀后缀数组的那种forforfor循环lll二分rrrCdfsdfsdfs贪心#includeusingnamespacestd;typedeflonglongll;unordered_mapf;llt,n;llq
- 后缀数组模板之高度数组
花落yu
java算法jvm
高度数组1.理解相关数组的含义rk[i]:表示原始下标为i的后缀字符串排序后对应的下标(也就是原始下标为i的后缀字符串排序后为第rk[i]小)height[i]:表示排名为i和i-1的后缀字符串的最长公共前缀的长度,注意这里的i是排名,不是原始下标2.定理证明定理:height[rk[i]]>=height[rk[i-1]]-1采用先抽象后具体的方式进行详细的证明。抽象证明假设原始下标i-1对应的
- 后缀数组模板
花落yu
java算法数据结构
详细理解后缀数组求sa数组的函数,该函数可以看为主要分为三个部分,第一个部分是预处理;第二个部分是进行基数排序,首先根据第二关键词排序,然后根据第一关键字排序;第三个部分是根据排序后的结果重新为每个字符串分配桶。后两个部分以倍增的形式重复,直到排序结束。理解各个数组的含义x[i]:记录原始下标为i的字符串所在桶的编号c[i]:记录编号为i的桶,在所有桶中的累计价值,也就是前缀和,在求前缀和之前,要
- 电量耗完的一天
自在_安然
俩娃都睡着了,陪小的睡觉,我的眼睛多次睁开闭合,疲惫至极,舍不得睡去,也不敢睡去。舍不得睡,感觉这一天能量耗尽,大脑需要充电;不敢睡,因为事情没做完,干完了家务事,可还有工作上的事情需要处理。昨天跟一个阿姨聊天,阿姨非常乐观,她说吃苦是福,我没有话语反驳,只是默默地点头。每个人修行的背后,都有一种信念在支撑。真的,修行之路很苦,所以需要苦中作乐,以苦为乐。就像现在的我,白天从早到晚带二宝,做家务,
- 【每日一题】从二叉搜索树到更大和树
wang_nn
LeetCode每日一题中序遍历二叉搜索树BST2023-12-04C++
文章目录Tag题目来源题目解读解题思路方法一:中序遍历的反序方法二:后缀数组写在最后Tag【中序遍历】【二叉树】【2023-12-04】题目来源1038.从二叉搜索树到更大和树题目解读在二叉搜索树中,将每一个节点的值替换成树中大于等于该节点值的所有节点值之和。解题思路方法一:中序遍历的反序前言给的是一棵二叉搜索树(英文名称为BinarySearchTree,以下简称为BST),我们要充分利用BST
- 磨炼自己的脾气
凌霜傲雪1903
图片发自App个人修行在个人,脾气不好就是修行不好,吃亏的是自己,吃什么不好,非要吃亏?好好爱自己,用温和的方式解决自己的事,少在别人的事上动气,这是每个人一生的修行。我这个人,脾气特别不好,暴躁易怒,炮仗一样,一点就着,生气起来歇斯底里不顾一切,什么话狠说什么,怎样说解恨就怎样说。可是说过骂过,气没有消,火没有降,还郁结于胸,损害了身体健康,破坏了家庭和谐,影响了人际关系。有时候想一想,人的脾气
- 珍惜当下,活在当下
惬意永不放弃
草有妨碍,理亦宜去,去之而已。偶未即去,亦不累心。若着了一分意思,即心体便有贻累,便有许多动气处。”——王阳明《传习录》一个人修行的过程,就是不断舍掉一些东西,卸掉心上的负累。让生命保持一份简单,轻装上阵,才能不负当下,拥抱未来。王阳明曾在《传习录》中写道:“草有妨碍,理亦宜去,去之而已。偶未即去,亦不累心。若着了一分意思,即心体便有贻累,便有许多动气处。”人生的烦恼、悔恨,就像是杂草一样,一定要
- 2022-05-26
莫忘小寒
不告诉别人要如何做,就不会背因果生活中大部分事情都不值得处理一个人修行情绪大是困难的放松一些菠萝蜜定出来确定方向生命是场体验体验很重要,有很多犯错误的时候犯错误喜悦心是给自己最好的礼物提高觉知力学会适度接纳各种各样的东西,一个兼容的人万物皆为我所用。一个兼容的人,万物皆为我所用纠结害怕耗能想做什么就做错了再改犯错了再来修正有福报的人,走哪里都不怕,船到桥头自然直现象通通不值得处理,处理根源和解能让
- 【读书笔记】《算法竞赛进阶指南》读书笔记——0x10基本数据结构
RM -RF /星
算法竞赛进阶指南C++ACMICPC算法读书笔记
todo(perhapsnever)CH1401后缀数组所有课后题栈例题:HDU4699Editor维护一个整数序列的编辑器,支持以下五种操作:Ix:在当前光标位置处插入一个整数x,插入后光标移动到x之后D:删除光标之前的一个元素,相当于按下退格键L:光标左移一个位置,相当于按下左方向键R:光标右移一个位置,相当于按下右方向键Qk:在位置k之前最大的前缀和,k不超过光标当前的位置建立两个栈,栈A储
- 求戒受挫
法净云沙
什么是“戒”?为什么要持戒?佛法说的戒定慧中的戒是什么意思呢?学诚法师:戒是对身语行为的规范,对个人修行而言,戒帮助我们断诸恶、行诸善,借由这些行为的庄重来帮助我们调伏粗猛的恶业烦恼,令心安定,为进一步的专注修行打下基础;对团体建设而言,戒能维护团体的稳定有序,譬如在世间,社会法律、学校校规、公司管理制度、团体规约……都有与戒相似之处。网友:修佛养性是自己心灵的事,为何要那么多的戒律呢?比如不让吃
- 后缀数组SA
Qres821
字符串后缀数组sa
https://uoj.ac/problem/35通过倍增实现排序类似基数排序,先排后面,再排前面排的过程可以拿桶排优化设h(i)=lcp(sa[rk[i]−1],i)h(i)=lcp(sa[rk[i]-1],i)h(i)=lcp(sa[rk[i]−1],i)有h(i)≥h(i−1)−1h(i)\geh(i-1)-1h(i)≥h(i−1)−1#includeusingnamespacestd;//
- 本圣开示 | 修行中信任的力量
闲人师兄
唐太宗时期,出现了“贞观之治”,他也被历史学家称为有道明君。而站在佛教的角度,他可以被称为“转轮圣王”。能够做一个“明君”,不仅表现在他的文治武功上,更表现在他的个人修行上。虽然他的父亲李渊就尊崇道教,好像还编了一本家谱,说自己是老子(李耳)的后人。但在太宗时期,他很开明的护持了佛教,恢复了很多寺院,玄奘法师取经回来后,他又大力支持了玄奘法师的译经工作。佛教在唐朝时期达到了鼎盛时期。在《资治通鉴》
- 戴尔笔记本win8系统改装win7系统
sophia天雪
win7戴尔改装系统win8
戴尔win8 系统改装win7 系统详述
第一步:使用U盘制作虚拟光驱:
1)下载安装UltraISO:注册码可以在网上搜索。
2)启动UltraISO,点击“文件”—》“打开”按钮,打开已经准备好的ISO镜像文
- BeanUtils.copyProperties使用笔记
bylijinnan
java
BeanUtils.copyProperties VS PropertyUtils.copyProperties
两者最大的区别是:
BeanUtils.copyProperties会进行类型转换,而PropertyUtils.copyProperties不会。
既然进行了类型转换,那BeanUtils.copyProperties的速度比不上PropertyUtils.copyProp
- MyEclipse中文乱码问题
0624chenhong
MyEclipse
一、设置新建常见文件的默认编码格式,也就是文件保存的格式。
在不对MyEclipse进行设置的时候,默认保存文件的编码,一般跟简体中文操作系统(如windows2000,windowsXP)的编码一致,即GBK。
在简体中文系统下,ANSI 编码代表 GBK编码;在日文操作系统下,ANSI 编码代表 JIS 编码。
Window-->Preferences-->General -
- 发送邮件
不懂事的小屁孩
send email
import org.apache.commons.mail.EmailAttachment;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import org.apache.commons.mail.MultiPartEmail;
- 动画合集
换个号韩国红果果
htmlcss
动画 指一种样式变为另一种样式 keyframes应当始终定义0 100 过程
1 transition 制作鼠标滑过图片时的放大效果
css
.wrap{
width: 340px;height: 340px;
position: absolute;
top: 30%;
left: 20%;
overflow: hidden;
bor
- 网络最常见的攻击方式竟然是SQL注入
蓝儿唯美
sql注入
NTT研究表明,尽管SQL注入(SQLi)型攻击记录详尽且为人熟知,但目前网络应用程序仍然是SQLi攻击的重灾区。
信息安全和风险管理公司NTTCom Security发布的《2015全球智能威胁风险报告》表明,目前黑客攻击网络应用程序方式中最流行的,要数SQLi攻击。报告对去年发生的60亿攻击 行为进行分析,指出SQLi攻击是最常见的网络应用程序攻击方式。全球网络应用程序攻击中,SQLi攻击占
- java笔记2
a-john
java
类的封装:
1,java中,对象就是一个封装体。封装是把对象的属性和服务结合成一个独立的的单位。并尽可能隐藏对象的内部细节(尤其是私有数据)
2,目的:使对象以外的部分不能随意存取对象的内部数据(如属性),从而使软件错误能够局部化,减少差错和排错的难度。
3,简单来说,“隐藏属性、方法或实现细节的过程”称为——封装。
4,封装的特性:
4.1设置
- [Andengine]Error:can't creat bitmap form path “gfx/xxx.xxx”
aijuans
学习Android遇到的错误
最开始遇到这个错误是很早以前了,以前也没注意,只当是一个不理解的bug,因为所有的texture,textureregion都没有问题,但是就是提示错误。
昨天和美工要图片,本来是要背景透明的png格式,可是她却给了我一个jpg的。说明了之后她说没法改,因为没有png这个保存选项。
我就看了一下,和她要了psd的文件,还好我有一点
- 自己写的一个繁体到简体的转换程序
asialee
java转换繁体filter简体
今天调研一个任务,基于java的filter实现繁体到简体的转换,于是写了一个demo,给各位博友奉上,欢迎批评指正。
实现的思路是重载request的调取参数的几个方法,然后做下转换。
- android意图和意图监听器技术
百合不是茶
android显示意图隐式意图意图监听器
Intent是在activity之间传递数据;Intent的传递分为显示传递和隐式传递
显式意图:调用Intent.setComponent() 或 Intent.setClassName() 或 Intent.setClass()方法明确指定了组件名的Intent为显式意图,显式意图明确指定了Intent应该传递给哪个组件。
隐式意图;不指明调用的名称,根据设
- spring3中新增的@value注解
bijian1013
javaspring@Value
在spring 3.0中,可以通过使用@value,对一些如xxx.properties文件中的文件,进行键值对的注入,例子如下:
1.首先在applicationContext.xml中加入:
<beans xmlns="http://www.springframework.
- Jboss启用CXF日志
sunjing
logjbossCXF
1. 在standalone.xml配置文件中添加system-properties:
<system-properties> <property name="org.apache.cxf.logging.enabled" value=&
- 【Hadoop三】Centos7_x86_64部署Hadoop集群之编译Hadoop源代码
bit1129
centos
编译必需的软件
Firebugs3.0.0
Maven3.2.3
Ant
JDK1.7.0_67
protobuf-2.5.0
Hadoop 2.5.2源码包
Firebugs3.0.0
http://sourceforge.jp/projects/sfnet_findbug
- struts2验证框架的使用和扩展
白糖_
框架xmlbeanstruts正则表达式
struts2能够对前台提交的表单数据进行输入有效性校验,通常有两种方式:
1、在Action类中通过validatexx方法验证,这种方式很简单,在此不再赘述;
2、通过编写xx-validation.xml文件执行表单验证,当用户提交表单请求后,struts会优先执行xml文件,如果校验不通过是不会让请求访问指定action的。
本文介绍一下struts2通过xml文件进行校验的方法并说
- 记录-感悟
braveCS
感悟
再翻翻以前写的感悟,有时会发现自己很幼稚,也会让自己找回初心。
2015-1-11 1. 能在工作之余学习感兴趣的东西已经很幸福了;
2. 要改变自己,不能这样一直在原来区域,要突破安全区舒适区,才能提高自己,往好的方面发展;
3. 多反省多思考;要会用工具,而不是变成工具的奴隶;
4. 一天内集中一个定长时间段看最新资讯和偏流式博
- 编程之美-数组中最长递增子序列
bylijinnan
编程之美
import java.util.Arrays;
import java.util.Random;
public class LongestAccendingSubSequence {
/**
* 编程之美 数组中最长递增子序列
* 书上的解法容易理解
* 另一方法书上没有提到的是,可以将数组排序(由小到大)得到新的数组,
* 然后求排序后的数组与原数
- 读书笔记5
chengxuyuancsdn
重复提交struts2的token验证
1、重复提交
2、struts2的token验证
3、用response返回xml时的注意
1、重复提交
(1)应用场景
(1-1)点击提交按钮两次。
(1-2)使用浏览器后退按钮重复之前的操作,导致重复提交表单。
(1-3)刷新页面
(1-4)使用浏览器历史记录重复提交表单。
(1-5)浏览器重复的 HTTP 请求。
(2)解决方法
(2-1)禁掉提交按钮
(2-2)
- [时空与探索]全球联合进行第二次费城实验的可能性
comsci
二次世界大战前后,由爱因斯坦参加的一次在海军舰艇上进行的物理学实验 -费城实验
至今给我们大家留下很多迷团.....
关于费城实验的详细过程,大家可以在网络上搜索一下,我这里就不详细描述了
在这里,我的意思是,现在
- easy connect 之 ORA-12154: TNS: 无法解析指定的连接标识符
daizj
oracleORA-12154
用easy connect连接出现“tns无法解析指定的连接标示符”的错误,如下:
C:\Users\Administrator>sqlplus username/
[email protected]:1521/orcl
SQL*Plus: Release 10.2.0.1.0 – Production on 星期一 5月 21 18:16:20 2012
Copyright (c) 198
- 简单排序:归并排序
dieslrae
归并排序
public void mergeSort(int[] array){
int temp = array.length/2;
if(temp == 0){
return;
}
int[] a = new int[temp];
int
- C语言中字符串的\0和空格
dcj3sjt126com
c
\0 为字符串结束符,比如说:
abcd (空格)cdefg;
存入数组时,空格作为一个字符占有一个字节的空间,我们
- 解决Composer国内速度慢的办法
dcj3sjt126com
Composer
用法:
有两种方式启用本镜像服务:
1 将以下配置信息添加到 Composer 的配置文件 config.json 中(系统全局配置)。见“例1”
2 将以下配置信息添加到你的项目的 composer.json 文件中(针对单个项目配置)。见“例2”
为了避免安装包的时候都要执行两次查询,切记要添加禁用 packagist 的设置,如下 1 2 3 4 5
- 高效可伸缩的结果缓存
shuizhaosi888
高效可伸缩的结果缓存
/**
* 要执行的算法,返回结果v
*/
public interface Computable<A, V> {
public V comput(final A arg);
}
/**
* 用于缓存数据
*/
public class Memoizer<A, V> implements Computable<A,
- 三点定位的算法
haoningabc
c算法
三点定位,
已知a,b,c三个顶点的x,y坐标
和三个点都z坐标的距离,la,lb,lc
求z点的坐标
原理就是围绕a,b,c 三个点画圆,三个圆焦点的部分就是所求
但是,由于三个点的距离可能不准,不一定会有结果,
所以是三个圆环的焦点,环的宽度开始为0,没有取到则加1
运行
gcc -lm test.c
test.c代码如下
#include "stdi
- epoll使用详解
jimmee
clinux服务端编程epoll
epoll - I/O event notification facility在linux的网络编程中,很长的时间都在使用select来做事件触发。在linux新的内核中,有了一种替换它的机制,就是epoll。相比于select,epoll最大的好处在于它不会随着监听fd数目的增长而降低效率。因为在内核中的select实现中,它是采用轮询来处理的,轮询的fd数目越多,自然耗时越多。并且,在linu
- Hibernate对Enum的映射的基本使用方法
linzx0212
enumHibernate
枚举
/**
* 性别枚举
*/
public enum Gender {
MALE(0), FEMALE(1), OTHER(2);
private Gender(int i) {
this.i = i;
}
private int i;
public int getI
- 第10章 高级事件(下)
onestopweb
事件
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
- 孙子兵法
roadrunners
孙子兵法
始计第一
孙子曰:
兵者,国之大事,死生之地,存亡之道,不可不察也。
故经之以五事,校之以计,而索其情:一曰道,二曰天,三曰地,四曰将,五
曰法。道者,令民于上同意,可与之死,可与之生,而不危也;天者,阴阳、寒暑
、时制也;地者,远近、险易、广狭、死生也;将者,智、信、仁、勇、严也;法
者,曲制、官道、主用也。凡此五者,将莫不闻,知之者胜,不知之者不胜。故校
之以计,而索其情,曰
- MySQL双向复制
tomcat_oracle
mysql
本文包括:
主机配置
从机配置
建立主-从复制
建立双向复制
背景
按照以下简单的步骤:
参考一下:
在机器A配置主机(192.168.1.30)
在机器B配置从机(192.168.1.29)
我们可以使用下面的步骤来实现这一点
步骤1:机器A设置主机
在主机中打开配置文件 ,
- zoj 3822 Domination(dp)
阿尔萨斯
Mina
题目链接:zoj 3822 Domination
题目大意:给定一个N∗M的棋盘,每次任选一个位置放置一枚棋子,直到每行每列上都至少有一枚棋子,问放置棋子个数的期望。
解题思路:大白书上概率那一张有一道类似的题目,但是因为时间比较久了,还是稍微想了一下。dp[i][j][k]表示i行j列上均有至少一枚棋子,并且消耗k步的概率(k≤i∗j),因为放置在i+1~n上等价与放在i+1行上,同理