fractional cascading
来源:互联网 发布:define在c语言中用法 编辑:程序博客网 时间:2024/06/07 03:51
fractional cascading
http://en.wikipedia.org/wiki/Fractional_cascading
加速binary search的方法。
用空间换时间。
假如同时有多个数组,然后在其中找某个数,一般做法是每个数组都查找过去。这样算法复杂度是 O(k log(n/k)),
As a simple example of fractional cascading, consider the following problem. We are given as input a collection of k ordered lists Li of real numbers, such that the total length Σ|Li| of all lists is n, and must process them so that we can perform binary searches for a query value q in each of the k lists. For instance, with k = 4 and n = 17,
- L1 = 2.4, 6.4, 6.5, 8.0, 9.3
- L2 = 2.3, 2.5, 2.6
- L3 = 1.3, 4.4, 6.2, 6.6
- L4 = 1.1, 3.5, 4.6, 7.9, 8.1
另外一种方法如下:
将这些数组合并到一个大数组,每个数跟着这个数在原来每个数组中的位置。
we may merge all the k lists into a single big list L, and associate with each item x of L a list of the results of searching for x in each of the smaller lists Li. If we describe an element of this merged list as x[a,b,c,d] where x is the numerical value and a, b, c, and d are the positions (the first number has position 0) of the next element at least as large as x in each of the original input lists (or the position after the end of the list if no such element exists), then we would have
- L = 1.1[0,0,0,0], 1.3[0,0,0,1], 2.3[0,0,1,1], 2.4[0,1,1,1], 2.5[1,1,1,1], 2.6[1,2,1,1],
- 3.5[1,3,1,1], 4.4[1,3,1,2], 4.6[1,3,2,2], 6.2[1,3,2,3], 6.4[1,3,3,3], 6.5[2,3,3,3],
- 6.6[3,3,3,3], 7.9[3,3,4,3], 8.0[3,3,4,4], 8.1[4,3,4,4], 9.3[4,3,4,5]
- 这样查找一个数,只要在L上查找,就能得到该数应该在每个数组中的位置。
fractional cascading:
上一行数组是下一行数组每隔1个取一个数在加上本行数组。
- M1 = 2.4[0, 1], 2.5[1, 1], 3.5[1, 3], 6.4[1, 5], 6.5[2, 5], 7.9[3, 5], 8[3, 6], 9.3[4, 6]
- M2 = 2.3[0, 1], 2.5[1, 1], 2.6[2, 1], 3.5[3, 1], 6.2[3, 3], 7.9[3, 5]
- M3 = 1.3[0, 1], 3.5[1, 1], 4.4[1, 2], 6.2[2, 3], 6.6[3, 3], 7.9[4, 3]
- M4 = 1.1[0, 0], 3.5[1, 0], 4.6[2, 0], 7.9[3, 0], 8.1[4, 0]
- fractional cascading
- 分散层叠(Fractional Cascading)
- 分散层叠(Fractional Cascading)
- 在知乎上看到的东西啦。fractional cascading
- 【算法】Fractional Multiscale Processing
- cascading基本概念
- 关于Cascading
- Cascading介绍
- T1、fractional T1和DS0
- CSS-Cascading StyleSheet
- cascading 入门 (一)
- Cascading Each Pipe 使用
- Mapr与Cascading工作
- Cascading TemplateTap的使用
- Hadoop Cascading简介
- cascading helloworld 案例
- Fractional-Order Control System Toolbox for MATLAB
- Hnu 13190 Fractional Lotion(数论)
- 经测试用unserialize,serialize处理数据比json_encode,json_decode要快!
- 软件开发随想:“分享”
- 关于automake生成makefile的问题
- 网络中工作组中计算机无法访问或没有选项的解决办法汇总
- thrift初体验
- fractional cascading
- poj 3714 Raid 计算几何
- 查找包含指定字符串的文件
- CentOS5.5中文图形安装oracle10G
- 说说我的男友
- Android到底那个Acitivity启动
- 如何用GCC编译出动态库文件(*.so)
- 2011程序员薪资调查报告
- 如何抓取QQ2010的聊天框