我是正常蛇

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年12月11日

摘要: mysql 复制配置 阅读全文
posted @ 2012-12-11 13:42 我是正常蛇 阅读(275) 评论(0) 推荐(0) 编辑

2012年9月10日

摘要: 指示器随机变量简单的说就是,事件发生 为1, 不发生则为0.比如,为事件q申请一个指示器随机变量Xq,此时如果q发生,则Xq = 1 ,否则等于0。一个重要的定理是: E(Xq) = q事件发生的概率 。从该定理中可以知道指示器可能是用来找期望的,实际上确实如此。下面来看如何理解指示器:假设RES为结果集,现在有事件A,B,C,D,E,F ,其发生概率为Pa , Pb ....先为其每一个事件设置指示器随即变量为 Xa Xb Xc ....那么现在RES可以很好的表示为RES = Xa*A + Xb*B + Xc*C ..... 此时 结果集包含了所有发生了的事件这个很好理解,A发生了则 Xa 阅读全文
posted @ 2012-09-10 21:45 我是正常蛇 阅读(395) 评论(0) 推荐(0) 编辑

摘要: 假设被排序数为 n 个, 找pivot的随机办法对每一个数的概率严格为 1/n .步骤一: 建模。假设将第 K 个数选为pivot , 则子问题规模为 k-1 和 n-k , 并且该分割的running time 为Θ(n)所以容易得到: T(n) = T(k-1) + T(n-k) +Θ(n)步骤二:用喊有指示随机变量 Xk 来表达T(n)。设Xk 为指示随机变量 (当第k个数被选为pivot ,则 Xk = 1 ,相反则等于0),则有:T(n) = X1(T(0) + T(n)+Θ(n)) + X2(T(1) + T(n)+Θ(n)) + ...... + Xn(T(n) + T(n)+Θ 阅读全文
posted @ 2012-09-10 20:23 我是正常蛇 阅读(446) 评论(0) 推荐(0) 编辑

2012年9月6日

摘要: What is it?If a binary tree who's node's value in left child tree is all smaller than root and the node's value in right child tree is all greater than root , and it also holds for any subtree in this tree, then this is a binary search tree.If we perform an inorder tree walk of T , which 阅读全文
posted @ 2012-09-06 16:45 我是正常蛇 阅读(335) 评论(0) 推荐(0) 编辑

2012年9月4日

摘要: Order Statistic:The ith smallest of n elements.(i from 1 to n).Median:The [n/2]th smallest of n elements.Here we all talk about value , not key.How to find the ith smallest number in a part of a array?Steps:1) Call the function partition which I have written down in quick sort chapter.Get the positi 阅读全文
posted @ 2012-09-04 15:00 我是正常蛇 阅读(654) 评论(0) 推荐(0) 编辑

2012年9月3日

摘要: Hash function:Solution: Use a hash function h(k) to map theuniverse U of all keys into continuous storage spaces{0, 1, ..., m–1}.Collision: When a record to be inserted maps to an alreadyoccupied slot in T.Resolving collisions:At first we assume that each key k ∈ K of keys is equally likely tobe has 阅读全文
posted @ 2012-09-03 22:51 我是正常蛇 阅读(356) 评论(0) 推荐(0) 编辑

摘要: Why comparison sort has a lower bound at least nlgn,which means T(n)=Ω(nlgn)?Decision-tree can easily tell why. A decision-tree is always a full binary tree. In camparison sort (like merge sort), every step is actually a comparison between 2 elements.And decision-tree list all these comparison cases 阅读全文
posted @ 2012-09-03 20:24 我是正常蛇 阅读(754) 评论(0) 推荐(0) 编辑

2012年9月2日

摘要: How it worksDivide: Partition the array into two subarrays around a pivot x such that elements in lower subarray ≤ x ≤ elements in upper subarray.Conquer: Recursively sort the two subarrays.Combine: Trivial.How to divide(Assume the array is start at p and end at q)1. First gives two pointer i j , i 阅读全文
posted @ 2012-09-02 20:55 我是正常蛇 阅读(217) 评论(0) 推荐(0) 编辑

摘要: Steps:Divide the problem (instance) into subproblems.Conquer the subproblems by solving them recursively.Combine subproblem solutions.A typical algorithm solved by D&V is merge sort. Frist we partitions the array into two sorted array recursivly, that is the Dvide part.Then we combine the two so 阅读全文
posted @ 2012-09-02 20:49 我是正常蛇 阅读(216) 评论(0) 推荐(0) 编辑

摘要: There are 3 methods to work out a Recurrence.Substitution method.Steps:Guess the result.Prove it by induction.Ex: T(n) = 4T(n/2) + n[Assume that T(1) = Θ(1)]Guess O(n3) . (Prove O and Ω separately.)Assume that T(k) ≤ ck3 for k < n .Prove T(n) ≤ cn3 by induction.T (n) = 4T (n / 2) + n ≤ 4c ( n / 2 阅读全文
posted @ 2012-09-02 19:21 我是正常蛇 阅读(421) 评论(0) 推荐(0) 编辑