- python使用MD5
18.程序员
哈希算法算法
一、要使用Python进行MD5加密,可以使用Python标准库中的hashlib模块。二、案例importhashlibstring="Hello,World!"#要进行加密的字符串hash_object=hashlib.md5(string.encode())#将字符串编码并进行MD5加密hash_hex=hash_object.hexdigest()#获取加密后的十六进制字符串print(h
- 题解|2024暑期杭电多校01
深翼CCLMSY
2024暑期杭电多校算法
【原文链接】1001.循环位移字符串题目大意给定两个字符串A,BA,BA,B。定义[A][A][A]为字符串AAA的循环位移任意次可以得到的所有字符串的集合。求BBB包含[A][A][A]中元素的个数。解题思路利用字符串Hash快速匹配。将[A][A][A]中所有元素的Hash记录到一个set:计算A+AA+AA+A的Hash前缀和,以快速得到所有长度为∣A∣|A|∣A∣的子串的Hash值,并加入
- Python redis数据库
没啥毛病
Python
redis是非关系型数据库,存储快,但是安全性较低redis数据结构有五大数据类型string字符串hash哈希list列表set集合zset有序集合基本操作redis-cli连接redis数据库exit退出sudoserviceredisstart/stop/restart操作服务端selectn切换数据库全局操作kyes*查看所有keydelkey删除一个renamekeynewKey修改名字
- 【字符串算法】刷题总结
一米の阳光
算法字符串
文章目录字符串一、c++字符串基本操作二、字符串hash三、字典树四、KMP算法字符串笔记参考《算法竞赛从入门到进阶》《算法竞赛进阶指南》一、c++字符串基本操作相关博客输入与输出chars1[100],s2[1001000];intl1,l2;scanf("%s",s1);//输入遇到回车结束l1=strlen(s1);//获取长度strings1;cin>>s1;//遇到换行或者回车结束cin
- 题解|#lanqiao 斤斤计较的小z# 字符串Hash模板
2301_79125642
java
题解|#三数之和###代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可###@paramnumint整型一维数组#@returnint整型我是软件开发,想搞大模型先抛个问题,像恒生、金蝶这类细分领域内的软件厂商龙头或者中小型的软件&互联网公司,他们想使用大模型时,要怎么办?其实如果往深处挖一挖,这个问题就把大模型题解|#判断两个IP是否属于同一子网#usestd::io::
- 字符串Hash的一个板子题的思考
Cx_330_PLT
哈希算法算法散列表
今天学到了字符串Hash,我觉得相对于kmp算法来说,字符串hash通过子串的hash值之间进行比较,字符串哈希适用于频繁比较和查找字符串的场景,例如判定两个字符串是否相等、判断字符串是否存在等。KMP算法适用于需要在一个字符串中寻找另一个字符串的出现位置的场景,例如查找关键字、实现字符串匹配等,对于复杂度来说,字符串hash的字符串比较通常在于O(1),但是有hash冲突,所以并不稳定,kmp算
- 缓存 - Redis 有哪些类型
撸帝
学习完整课程请移步互联网Java全栈工程师在Redis中有五种数据类型String:字符串Hash:字典List:列表Set:集合SortedSet:有序集合
- 第 380 场周赛 解题报告 | 珂学家 | 数位DP & 二分 + 字符串Hash
珂朵莉MM
力扣周赛解题报告哈希算法算法力扣java
前言整体评价感觉T3更难些,T4太直接了,一般的KMP/StringHash基本就够用了。上周T4出数位DP,估计是为T3打了一个铺垫。A.最大频率元素计数思路:模拟即可classSolution{publicintmaxFrequencyElements(int[]nums){Maphash=newHashMapx==fre).count()*fre;}}B.找出数组中的美丽下标I和T4一起讲C
- C++ 字符串哈希 || 字符串前缀哈希法
伏城无嗔
力扣算法笔记哈希哈希算法c++算法
字符串Hash就是构造一个数字使之唯一代表一个字符串。但是为了将映射关系进行一一对应,也就是,一个字符串对应一个数字,那么一个数字也对应一个字符串。用字符串Hash的目的是,我们如果要比较一个字符串,我们不用直接比较字符串,而是比较它对应映射的数字,这样子就知道两个“子串”是否相等。从而达到,子串的Hash值的时间为O(1),进而可以利用“空间换时间”来节省时间复杂的。##############
- SQL实践篇(三):什么是Redis
经年藏殊
#SQL基础sqlredis数据库
文章目录简介Redis是什么,为什么这么快?Redis的数据类型字符串Hash字符串列表字符串集合有序字符串集合其他数据类型总结参考文献简介Redis是一种基于内存的键值数据库,键值数据库会使用哈希表存储key和value。其中key和value可以是任何内容,无论是简单对象还是复杂对象。键值数据库是NoSQL思想,其规则是"只提供你想要的",因此模型很灵活,查询效率也高,成本也低。而RDBMS是
- 最长回文子串
谷神星ceres
#问题杂录哈希算法算法c++
如果一个字符串正着读和倒着读是一样的,我们则称它是回文字符串。给定一个长度为N的字符串S,求它的最长回文子串。N≤1000N\leq1000N≤1000。1.枚举回文串中心位置,利用字符串Hash比较相等我们可以枚举S的回文子串的中心位置i=1~N,看从这个中心位置出发左右两侧最长可以扩展出多长的回文串。也就是说:1.求一个最大整数x使得S[i−x+1∼i]=reverse(S[i∼i+x−1])
- 字符串哈希,帮您解决记不住kmp的烦恼~
芒果冰mangoicel
芒果小课堂!java算法
//思想,把字符串映射为哈希值,通过哈希值就可以定位唯一字符串,可以某种程度上替代kmp,而且比kmp好理解好记忆//字符串hash模板intP=131;//或者13331经验值Strings="hello";intn=s.length();long[]h=newlong[n+1],p=newlong[n+1];p[0]=1;//计算出模板的h,p值for(inti=1;i二分咋样?//这边给小伙
- 字符串hash算法
蒲公英之殇
杂点字符串
感觉没找到什么例题,但也是一个重要的思考方式,复杂度O(1)。经典问题:如果有一个庞大的字符串数组,然后给你一个单独的字符串,让你从这个数组中查找是否有这个字符串并找到它。字符串hash是指将一个字符串s映射为一个,使得该整数可以尽可能唯一的代表也就是唯一标识。换言之,如果两个字符的hash值相同那么我们可以认为两者相同。字符串hasn函数有很多种,下面这篇博客有做比较:各种字符串Hash函数比较
- Redis的数据类型+命令手册
weixin_46612124
入门javaredis
Redis的数据类型包含:String:字符串Hash:哈希表List:列表Set:集合zset:SortSet有序集合常用Redis命令手册参考http://doc.redisfans.com/2.常用命令命令./redis-cli--raw描述setkeyvalue设置指定key的值,如果存在将修改getkey获取指定key的值getsetkeyvalue设置指定key的值,如果存在将修改mg
- redis常见数据类型
达摩院扫地僧
redisredis数据类型
一.redis的五大数据类型String字符串Hash哈希,类似java中的MapList列表Set无序不重复的集合Zset有序集合(sortedset)二.常用key的命令keys*查看所有的键值对existskey的名字,判断某个key是否存在movekeydb当前库就没有了,被移除expirekey秒钟:给定的key设置过期时间ttlkey查看还有多少秒过期,-1表示永不过期,-2表示已过期
- Mycat应用2-分库分表实战
布史
#Mycat
文章目录一.配置规则1.分片方式2.配置规则二.连续分片1.自定义数字范围分片2.按日期分片3.按单月小时分片4.按自然月分片三.离散分片1.枚举分片2.程序指定分区的分片3.十进制求模分片4.字符串hash解析分片5.一致性哈希分片四.综合分片1.范围求模分片2.日期范围hash分片3.取模范围约束分片4.ASCII码求模范围约束(字符串)5.固定分片hash(二进制)六.分片策略一.配置规则1
- 【算法学习】字符串哈希(Hash)
Mikchy
数据结构字符串hash
什么是字符串Hash构造字符串Hash1)自然溢出方法2)单Hash方法3)双Hash方法4)三种不同的构造方法的对比获取子串的HashO(1)1)例子2)公式具体的题目例子1)题目链接2)题意3)解题分析4)AC代码(自然溢出C++)5)AC代码(单HashC++)6)AC代码(双HashC++)什么是字符串Hashhash,其实就是将一个东西映射成另一个东西,类似Map,key对应value。
- c++-哈希
dong132697
c++笔记c++笔记
文章目录前言一、unordered系列关联式容器1、unordered_map2、性能测试二、哈希1、哈希概念2、哈希冲突3、哈希冲突解决3.1闭散列3.2开散列3.3字符串Hash函数3.4哈希桶实现的哈希表的效率三、哈希表封装unordered_map和unordered_set容器1、unordered_map和unordered_set插入结点的实现2、unordered_map和unor
- leetcode187. 重复的DNA序列(中等)
重you小垃
#slidewindows&双指针哈希算法leetcode算法
思路:长度为10+子数组->固定滑动窗口细节:1.怎么比较两个字符串相等?也就是如何映射?方法一:字符串hash方法二:由于只有4个字符,因此用两个位表示一个字符,10个字符需要20位,int可以表示出该字符串。A:0C:1G:2T:3右边界添加一个字符:flagfindRepeatedDnaSequences(strings){unordered_maphash{{'A',0},{'C',1},
- 字符串算法:字典树trie
麦片老板
算法竞赛入门经典数据结构与算法蓝桥杯算法字符串
字典树trie1.原理先看一张图看不懂很正常如果你看懂了,那么原理就可以直接跳过比如说我们现在有几个字符串ininninttotentea我们想知道te是哪几个字符串的前缀?这个时候我们显然可以一个一个去比较,但是这样的效率有点低,我们也可以想到用字符串hash去比较,但是这样的效率还是有点低这个时候字典树就排上用场了字典树说白了就是一个字典和我们平时查英语的字典一样,比如我们现在要去查一个单词h
- 字符串hash
麦片老板
数据结构与算法蓝桥杯算法竞赛入门经典算法字符串
字符串hash原理我的理解是:这是一种很玄学的字符串匹配算法比如我们现在有一个字符串:str="abcde"通过一个hash函数,我们假设为intmhash()[为什么要写成mhash?因为hash()在库函数已经有了]那我们得到的str的哈希值str_hash=mhash(str)接下来是mhash的实现代码:听说这种是比较不会发生冲突的了typedefunsignedlonglongull;/
- Redis命令操作
宸风如苏
1.添加、修改、获取、删除操作set键值添加操作set键新值修改操作get键获取操作(若键不存在,则返回nil表示无值)del键1...键n删除操作(返回删除成功的个数)2.常用五种数据类型的操作1:五种数据类型string字符串hash哈希list字符串列表set字符串集合sortedset有序字符串集合2:字符串型操作mset键1值1...键n值n添加多个键mset键1新值1...键n新值n修
- 字符串Hash总结
liang_2026
总结c++算法hash
一.什么是字符串Hash字符串Hash就是把一个字符串表示为一个unsignedlonglong类型的数,用这个数与其它字符串的Hash值进行比对。(可配合hash表一起使用)。二.字符串Hash原理取一固定值base,把字符串看作base进制数,并分配一个大于0的数值,代表每种字符。一般来说,对每种字符的分配值都小于base(可以直接使用字符的Ascall值)。但是,字符串用base进制数表示后
- 各种字符串Hash函数比较
小小哭包
算法和数据结构哈希算法算法c++C
常用的字符串Hash函数还有ELFHash,APHash等等,都是十分简单有效的方法。这些函数使用位运算使得每一个字符都对最后的函数值产生影响。另外还有以MD5和SHA1为代表的杂凑函数,这些函数几乎不可能找到碰撞。常用字符串哈希函数有BKDRHash,APHash,DJBHash,JSHash,RSHash,SDBMHash,PJWHash,ELFHash等等。对于以上几种哈希函数,我对其进行了
- 字符串Hash学习笔记
拧错位置的螺丝钉
#字符串哈希算法学习笔记
哈希算法哈希算法是通过一个哈希函数HHH,将一种数据(包括字符串、较大的数等)转化为能够用变量表示或是直接就可作为数组下标的数。哈希值通过哈希函数转化的得到的数值。可以通过哈希值实现快速查找和匹配。简介寻找长度为nnn的主串SSS中的匹配串TTT(长度为mmm)出现的位置或次数的问题属于字符串匹配问题。朴素的想法是枚举所有起始位置,再直接检查是否匹配。可以不使用O(m)O(m)O(m)的直接比较字
- 【CUC集训】字典树+kmp+字符串hash题解
数字_ID
制作:数字_ID日期:2018年8月27日A(HDU-2087)简单KMP,注意匹配成功之后j归0#include#include#includeusingnamespacestd;intnexta[1006];chart[1006],s[1006];voidgetnexta(chars[]){memset(nexta,0,sizeof(nexta));intn=strlen(s);intk=-1
- 字符串hash模板(acwing841)
yusen_123
数据结构哈希算法算法
代码:#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#include#include#includeusingnamespacestd;constlonglongN=200003;constintP=131;typedefunsignedlonglongULL;ULLh[N],p[N];charst[N]
- Hash(哈希(字符串哈希))模板和做题总结(详细易懂)
?!??
哈希算法算法c++数据结构散列表
文章目录目录文章目录前言:一Hash表1Hash函数的构造2拉链法处理hash冲突模板3开放寻址法处理hash冲突4(例题)、雪花雪花二字符串HashO(n)+O(m)1.回文子串的最大长度2后缀数组3矩阵4树形地铁系统(涉及树的知识)三C++ST库之unordered_map——哈希表前言:在学习本节课之前,请大家思考这样一个问题:如果我们要在一个长度为的随机整数序列中统计每个数出现的次数,可以
- ACwing 841 - 字符串哈希(字符串hash)
吃柚子的玫瑰食客
Hash字符串哈希表hash
给定一个长度为n的字符串,再给定m个询问,每个询问包含四个整数l1,r1,l2,r2,请你判断[l1,r1]和[l2,r2]这两个区间所包含的字符串子串是否完全相同。字符串中只包含大小写英文字母和数字。输入格式第一行包含整数n和m,表示字符串长度和询问次数。第二行包含一个长度为n的字符串,字符串中只包含大小写英文字母和数字。接下来m行,每行包含四个整数l1,r1,l2,r2,表示一次询问所涉及的两
- 字符串hash编码方式 Rabin-Karp
Ahub_Ha
字符串算法c++哈希算法
Rabin-Karp是对字符串进行hash返回一个数字(int,long,longlong)的算法。如果字符串只包含小写字符:首先第一步,对每个字母进行编码,a-z分别代表0-25.intn=strings[i]-'a';//示例并非严谨代码编号之后引入Rabin-Karp算法,实际上是个多进制转换算法在字符串中的应用,举例全是小写字母,所以进制a为26,再设为字符串的第i个字母对应上面的编码数字
- PHP如何实现二维数组排序?
IT独行者
二维数组PHP排序
二维数组在PHP开发中经常遇到,但是他的排序就不如一维数组那样用内置函数来的方便了,(一维数组排序可以参考本站另一篇文章【PHP中数组排序函数详解汇总】)。二维数组的排序需要我们自己写函数处理了,这里UncleToo给大家分享一个PHP二维数组排序的函数:
代码:
functionarray_sort($arr,$keys,$type='asc'){
$keysvalue= $new_arr
- 【Hadoop十七】HDFS HA配置
bit1129
hadoop
基于Zookeeper的HDFS HA配置主要涉及两个文件,core-site和hdfs-site.xml。
测试环境有三台
hadoop.master
hadoop.slave1
hadoop.slave2
hadoop.master包含的组件NameNode, JournalNode, Zookeeper,DFSZKFailoverController
- 由wsdl生成的java vo类不适合做普通java vo
darrenzhu
VOwsdlwebservicerpc
开发java webservice项目时,如果我们通过SOAP协议来输入输出,我们会利用工具从wsdl文件生成webservice的client端类,但是这里面生成的java data model类却不适合做为项目中的普通java vo类来使用,当然有一中情况例外,如果这个自动生成的类里面的properties都是基本数据类型,就没问题,但是如果有集合类,就不行。原因如下:
1)使用了集合如Li
- JAVA海量数据处理之二(BitMap)
周凡杨
java算法bitmapbitset数据
路漫漫其修远兮,吾将上下而求索。想要更快,就要深入挖掘 JAVA 基础的数据结构,从来分析出所编写的 JAVA 代码为什么把内存耗尽,思考有什么办法可以节省内存呢? 啊哈!算法。这里采用了 BitMap 思想。
首先来看一个实验:
指定 VM 参数大小: -Xms256m -Xmx540m
- java类型与数据库类型
g21121
java
很多时候我们用hibernate的时候往往并不是十分关心数据库类型和java类型的对应关心,因为大多数hbm文件是自动生成的,但有些时候诸如:数据库设计、没有生成工具、使用原始JDBC、使用mybatis(ibatIS)等等情况,就会手动的去对应数据库与java的数据类型关心,当然比较简单的数据类型即使配置错了也会很快发现问题,但有些数据类型却并不是十分常见,这就给程序员带来了很多麻烦。
&nb
- Linux命令
510888780
linux命令
系统信息
arch 显示机器的处理器架构(1)
uname -m 显示机器的处理器架构(2)
uname -r 显示正在使用的内核版本
dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI)
hdparm -i /dev/hda 罗列一个磁盘的架构特性
hdparm -tT /dev/sda 在磁盘上执行测试性读取操作
cat /proc/cpuinfo 显示C
- java常用JVM参数
墙头上一根草
javajvm参数
-Xms:初始堆大小,默认为物理内存的1/64(<1GB);默认(MinHeapFreeRatio参数可以调整)空余堆内存小于40%时,JVM就会增大堆直到-Xmx的最大限制
-Xmx:最大堆大小,默认(MaxHeapFreeRatio参数可以调整)空余堆内存大于70%时,JVM会减少堆直到 -Xms的最小限制
-Xmn:新生代的内存空间大小,注意:此处的大小是(eden+ 2
- 我的spring学习笔记9-Spring使用工厂方法实例化Bean的注意点
aijuans
Spring 3
方法一:
<bean id="musicBox" class="onlyfun.caterpillar.factory.MusicBoxFactory"
factory-method="createMusicBoxStatic"></bean>
方法二:
- mysql查询性能优化之二
annan211
UNIONmysql查询优化索引优化
1 union的限制
有时mysql无法将限制条件从外层下推到内层,这使得原本能够限制部分返回结果的条件无法应用到内层
查询的优化上。
如果希望union的各个子句能够根据limit只取部分结果集,或者希望能够先排好序在
合并结果集的话,就需要在union的各个子句中分别使用这些子句。
例如 想将两个子查询结果联合起来,然后再取前20条记录,那么mys
- 数据的备份与恢复
百合不是茶
oraclesql数据恢复数据备份
数据的备份与恢复的方式有: 表,方案 ,数据库;
数据的备份:
导出到的常见命令;
参数 说明
USERID 确定执行导出实用程序的用户名和口令
BUFFER 确定导出数据时所使用的缓冲区大小,其大小用字节表示
FILE 指定导出的二进制文
- 线程组
bijian1013
java多线程threadjava多线程线程组
有些程序包含了相当数量的线程。这时,如果按照线程的功能将他们分成不同的类别将很有用。
线程组可以用来同时对一组线程进行操作。
创建线程组:ThreadGroup g = new ThreadGroup(groupName);
&nbs
- top命令找到占用CPU最高的java线程
bijian1013
javalinuxtop
上次分析系统中占用CPU高的问题,得到一些使用Java自身调试工具的经验,与大家分享。 (1)使用top命令找出占用cpu最高的JAVA进程PID:28174 (2)如下命令找出占用cpu最高的线程
top -Hp 28174 -d 1 -n 1
32694 root 20 0 3249m 2.0g 11m S 2 6.4 3:31.12 java
- 【持久化框架MyBatis3四】MyBatis3一对一关联查询
bit1129
Mybatis3
当两个实体具有1对1的对应关系时,可以使用One-To-One的进行映射关联查询
One-To-One示例数据
以学生表Student和地址信息表为例,每个学生都有都有1个唯一的地址(现实中,这种对应关系是不合适的,因为人和地址是多对一的关系),这里只是演示目的
学生表
CREATE TABLE STUDENTS
(
- C/C++图片或文件的读写
bitcarter
写图片
先看代码:
/*strTmpResult是文件或图片字符串
* filePath文件需要写入的地址或路径
*/
int writeFile(std::string &strTmpResult,std::string &filePath)
{
int i,len = strTmpResult.length();
unsigned cha
- nginx自定义指定加载配置
ronin47
进入 /usr/local/nginx/conf/include 目录,创建 nginx.node.conf 文件,在里面输入如下代码:
upstream nodejs {
server 127.0.0.1:3000;
#server 127.0.0.1:3001;
keepalive 64;
}
server {
liste
- java-71-数值的整数次方.实现函数double Power(double base, int exponent),求base的exponent次方
bylijinnan
double
public class Power {
/**
*Q71-数值的整数次方
*实现函数double Power(double base, int exponent),求base的exponent次方。不需要考虑溢出。
*/
private static boolean InvalidInput=false;
public static void main(
- Android四大组件的理解
Cb123456
android四大组件的理解
分享一下,今天在Android开发文档-开发者指南中看到的:
App components are the essential building blocks of an Android
- [宇宙与计算]涡旋场计算与拓扑分析
comsci
计算
怎么阐述我这个理论呢? 。。。。。。。。。
首先: 宇宙是一个非线性的拓扑结构与涡旋轨道时空的统一体。。。。
我们要在宇宙中寻找到一个适合人类居住的行星,时间非常重要,早一个刻度和晚一个刻度,这颗行星的
- 同一个Tomcat不同Web应用之间共享会话Session
cwqcwqmax9
session
实现两个WEB之间通过session 共享数据
查看tomcat 关于 HTTP Connector 中有个emptySessionPath 其解释如下:
If set to true, all paths for session cookies will be set to /. This can be useful for portlet specification impleme
- springmvc Spring3 MVC,ajax,乱码
dashuaifu
springjquerymvcAjax
springmvc Spring3 MVC @ResponseBody返回,jquery ajax调用中文乱码问题解决
Spring3.0 MVC @ResponseBody 的作用是把返回值直接写到HTTP response body里。具体实现AnnotationMethodHandlerAdapter类handleResponseBody方法,具体实
- 搭建WAMP环境
dcj3sjt126com
wamp
这里先解释一下WAMP是什么意思。W:windows,A:Apache,M:MYSQL,P:PHP。也就是说本文说明的是在windows系统下搭建以apache做服务器、MYSQL为数据库的PHP开发环境。
工欲善其事,必须先利其器。因为笔者的系统是WinXP,所以下文指的系统均为此系统。笔者所使用的Apache版本为apache_2.2.11-
- yii2 使用raw http request
dcj3sjt126com
http
Parses a raw HTTP request using yii\helpers\Json::decode()
To enable parsing for JSON requests you can configure yii\web\Request::$parsers using this class:
'request' =&g
- Quartz-1.8.6 理论部分
eksliang
quartz
转载请出自出处:http://eksliang.iteye.com/blog/2207691 一.概述
基于Quartz-1.8.6进行学习,因为Quartz2.0以后的API发生的非常大的变化,统一采用了build模式进行构建;
什么是quartz?
答:简单的说他是一个开源的java作业调度框架,为在 Java 应用程序中进行作业调度提供了简单却强大的机制。并且还能和Sp
- 什么是POJO?
gupeng_ie
javaPOJO框架Hibernate
POJO--Plain Old Java Objects(简单的java对象)
POJO是一个简单的、正规Java对象,它不包含业务逻辑处理或持久化逻辑等,也不是JavaBean、EntityBean等,不具有任何特殊角色和不继承或不实现任何其它Java框架的类或接口。
POJO对象有时也被称为Data对象,大量应用于表现现实中的对象。如果项目中使用了Hiber
- jQuery网站顶部定时折叠广告
ini
JavaScripthtmljqueryWebcss
效果体验:http://hovertree.com/texiao/jquery/4.htmHTML文件代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>网页顶部定时收起广告jQuery特效 - HoverTree<
- Spring boot内嵌的tomcat启动失败
kane_xie
spring boot
根据这篇guide创建了一个简单的spring boot应用,能运行且成功的访问。但移植到现有项目(基于hbase)中的时候,却报出以下错误:
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.Lif
- leetcode: sort list
michelle_0916
Algorithmlinked listsort
Sort a linked list in O(n log n) time using constant space complexity.
====analysis=======
mergeSort for singly-linked list
====code======= /**
* Definition for sin
- nginx的安装与配置,中途遇到问题的解决
qifeifei
nginx
我使用的是ubuntu13.04系统,在安装nginx的时候遇到如下几个问题,然后找思路解决的,nginx 的下载与安装
wget http://nginx.org/download/nginx-1.0.11.tar.gz
tar zxvf nginx-1.0.11.tar.gz
./configure
make
make install
安装的时候出现
- 用枚举来处理java自定义异常
tcrct
javaenumexception
在系统开发过程中,总少不免要自己处理一些异常信息,然后将异常信息变成友好的提示返回到客户端的这样一个过程,之前都是new一个自定义的异常,当然这个所谓的自定义异常也是继承RuntimeException的,但这样往往会造成异常信息说明不一致的情况,所以就想到了用枚举来解决的办法。
1,先创建一个接口,里面有两个方法,一个是getCode, 一个是getMessage
public
- erlang supervisor分析
wudixiaotie
erlang
当我们给supervisor指定需要创建的子进程的时候,会指定M,F,A,如果是simple_one_for_one的策略的话,启动子进程的方式是supervisor:start_child(SupName, OtherArgs),这种方式可以根据调用者的需求传不同的参数给需要启动的子进程的方法。和最初的参数合并成一个数组,A ++ OtherArgs。那么这个时候就有个问题了,既然参数不一致,那