题目:合并两个有序单链表思路:一开始想复杂了,以为必须在原链表上修改(绕来绕去还AC了,但是思路相当绕),其实没有,按照正常地合并两个数组同样的方法也对。代码:public
ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1 ...
分类:
其他好文 时间:
2014-05-19 07:48:32
阅读次数:
314
一般来说,消息队列有两种场景,一种是发布者订阅者模式,一种是生产者消费者模式。利用redis这两种场景的消息队列都能够实现。定义:生产者消费者模式:生产者生产消息放到队列里,多个消费者同时监听队列,谁先抢到消息谁就会从队列中取走消息;即对于每个消息只能被最多一个消费者拥有。发布者订阅者模式:发布者生...
分类:
其他好文 时间:
2014-05-19 06:59:46
阅读次数:
446
Redis 介绍
redis 这个想必大家都了解,关于redis的安装参考这里,redis使用文档参见这里。
Redis C客户端的使用方法
Redis的c客户端 Hiredis使用比较广泛,下面主要介绍下它。
1,Hiredis的安装,配置
Hiredis客户端 在redis解压后的deps/hiredis下有相应的文件。如果你的安装包没有相应的文件可以到这里下载。
cd...
分类:
编程语言 时间:
2014-05-18 18:38:34
阅读次数:
418
【题目】
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given input array A ...
分类:
其他好文 时间:
2014-05-18 18:25:19
阅读次数:
272
【题目】
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replac...
分类:
其他好文 时间:
2014-05-18 09:54:53
阅读次数:
242
【题目】
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
【题意】
合并K个有序链表
【思路】
归并
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For ...
分类:
其他好文 时间:
2014-05-18 09:05:40
阅读次数:
255
通常在redis机器数量多的时候,需要对redis的机器进行状态监控,可以采用Linux 的nc 来对多个shard进行状态查询和监测...
分类:
其他好文 时间:
2014-05-18 05:51:38
阅读次数:
247
在ecplise中使用内存数据的客端户,前提要准备要下载两个jar包
commons-pool2-2.0.jar http://download.csdn.net/detail/f765961322/7357673;
jedis-2.4.2.jar http://download.csdn.net/detail/f765961322/7357681;
前提...
分类:
数据库 时间:
2014-05-18 04:31:42
阅读次数:
320
Remove Duplicates from Sorted List IGiven a
sorted linked list, delete all duplicates such that each element appear only
once.For example,Given 1->1->...
分类:
其他好文 时间:
2014-05-18 01:41:31
阅读次数:
361
Redis是一个用的比较广泛的Key/Value的内存数据库,新浪微博、Github、StackOverflow等大型应用中都用其作为缓存,Redis的官网为http://redis.io/。最近项目中需要使用Redis,这里简单记录一下Redis的安装,以及如何在.NET中使用Redis。Redi...
分类:
Web程序 时间:
2014-05-17 23:28:11
阅读次数:
473