- 博客(24)
- 资源 (1)
- 收藏
- 关注
转载 epoll实现分析
转载地址:poll&&epoll实现分析(二)——epoll实现 Epoll实现分析——作者:lvyilong316通过上一章分析,poll运行效率的两个瓶颈已经找出,现在的问题是怎么改进。首先,如果要监听1000个fd,每次poll都要把1000个fd 拷入内核,太不科学了,内核干嘛不自己保存已经拷入的fd呢?答对了,epoll就是自己保存拷入的fd,它的API就已经说明了这一点
2015-07-30 16:23:54 537
原创 hiho一下 第五十四周 题目1 : 连通性·三
题目1 : 连通性·三时间限制:10000ms单点时限:1000ms内存限制:256MB描述暑假到了!!小Hi和小Ho为了体验生活,来到了住在大草原的约翰家。今天一大早,约翰因为有事要出去,就拜托小Hi和小Ho忙帮放牧。约翰家一共有N个草场,每个草场有容量为W[i]的牧草,N个草场之间有M条单向的路径。小Hi和小Ho需要将牛羊
2015-07-16 10:51:12 870 1
原创 LIS 最长上升子序列问题 nlgn时间打印其中一个序列
什么是最长上升子序列?从字面意思就很好理解,就是从一系列顺序输入中,寻找一个上升子序列,要求这个子序列的长度最长。对O(n^2)的解法(DP)这里不讨论了,主要说一下nlgn的解法。网上查了一下,都是通过维护一个数组来实现该算法,但是只给出了求最长上升子序列的长度的代码,没有返回要求的子序列。这里就将此方法扩展一下,使得算法可以返回一个满足条件的子序列。好吧,其实在维基上就有该算法的详细介绍和伪码
2015-06-13 11:51:44 1811
转载 Redis dictScan反向二进制迭代器
转载自http://chenzhenianqing.cn/articles/1101.html#comment-46945关于这个算法的源头,来自于githup这里:Add SCAN command #579,长篇的讨论,确实难懂····建议看看这帖子,antirez 跟pietern 关于这个奇怪算法的讨论···这个算法的作者是:Pieter Noordhuis,作者称其为:re
2015-06-09 16:27:26 939
原创 redis内存管理代码注释
zmalloc.h/* zmalloc - total amount of allocated memory aware version of malloc() * * Copyright (c) 2009-2010, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source a
2015-06-03 19:15:50 960
原创 uva442-Matrix Chain Multiplication
Matrix Chain Multiplication Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multi
2014-07-13 15:29:36 607
原创 uva673-Parentheses Balance
Parentheses Balance You are given a string consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A and B are correct, AB is c
2014-07-13 12:17:23 715
原创 uva133-The Dole Queue
The Dole Queue In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every day all dole applicants
2014-07-12 22:17:02 600
原创 uva465 - Overflow
Overflow Write a program that reads an expression consisting of two non-negative integer and an operator. Determine if either integer or the result of the expression is too large to be rep
2014-05-04 20:19:51 539
原创 uva10361 - Automatic Poetry
Problem IAutomatic PoetryInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”
2014-04-26 22:03:58 389
原创 uva10010 - Where's Waldorf?
Where's Waldorf? Given a m by n grid of letters, ( ), and a list of words, find the location in the grid at which the word can be found. A word matches a straight, uninterrupted line o
2014-04-26 22:00:39 431
原创 uva537 - Artificial Intelligence?
Artificial Intelligence? Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and understan
2014-04-26 21:56:43 551
原创 uva699 - The Falling Leaves
The Falling Leaves Each year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating unde
2014-04-17 15:29:12 444
原创 uva712 - S-Trees
S-Trees A Strange Tree (S-tree) over the variable set is a binary tree representing a Boolean function . Each path of the S-tree begins at the root node and consists of n+1 nodes. E
2014-04-17 13:12:30 542
原创 uva297 - Quadtrees
Quadtrees A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may agai
2014-04-16 22:46:59 370
原创 uva548 - Tree
Tree You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of
2014-04-16 11:29:56 587
原创 uva112 - Tree Summing
Tree Summing BackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, which are the fundam
2014-04-14 23:26:57 403
原创 题目2 : 大神与三位小伙伴
时间限制:2000ms单点时限:1000ms内存限制:256MB描述L国是一个有着优美景色且物产丰富的国家,很多人都喜欢来这里旅游并且喜欢带走一些纪念品,大神同学也不例外。距离开L国的时间越来越近了,大神同学正在烦恼给她可爱的小伙伴们带什么纪念品好,现在摆在大神同学面前的有三类纪念品A, B, C可以选择,每类纪念品各有N种。其中种类为A_i, B_i, C
2014-04-12 20:15:36 552
原创 uva101 - The Blocks Problem
The Block ProblemThe BackgroundMany areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robotics (STRIPS) u
2014-03-29 23:37:41 541 2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人