k-d Tree in TripAdvisor
Today, TripAdvisor held a tech talk in Columbia University. The topic is about k-d Tree implemented in TripAdvisor to efficiently search MASSIVE location tree.
Problem
Millions of locations, it's tough to perform Nearest Neighbor Search.
Solution
Using k-d tree to implement location tree.
It's a space-partitioning balanced binary tree. And k is the number of dimension.
k-d Tree
pseudocode
function kdtree (list of points pointList, int depth)
{
// Select axis based on depth so that axis cycles through all valid values
var int axis := depth mod k; // Sort point list and choose median as pivot element
select median by axis from pointList; // Create node and construct subtrees
var tree_node node;
node.location := median;
node.leftChild := kdtree(points in pointList before median, depth+1);
node.rightChild := kdtree(points in pointList after median, depth+1);
return node;
}
k-d Tree in TripAdvisor的更多相关文章
- 第46届ICPC澳门站 K - Link-Cut Tree // 贪心 + 并查集 + DFS
原题链接:K-Link-Cut Tree_第46屆ICPC 東亞洲區域賽(澳門)(正式賽) (nowcoder.com) 题意: 要求一个边权值总和最小的环,并从小到大输出边权值(2的次幂):若不存在 ...
- AOJ DSL_2_C Range Search (kD Tree)
Range Search (kD Tree) The range search problem consists of a set of attributed records S to determi ...
- Size Balance Tree(SBT模板整理)
/* * tree[x].left 表示以 x 为节点的左儿子 * tree[x].right 表示以 x 为节点的右儿子 * tree[x].size 表示以 x 为根的节点的个数(大小) */ s ...
- HDU3333 Turing Tree(线段树)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=3333 Description After inventing Turing Tree, 3x ...
- K-D Tree
这篇随笔是对Wikipedia上k-d tree词条的摘录, 我认为解释得相当生动详细, 是一篇不可多得的好文. Overview A \(k\)-d tree (short for \(k\)-di ...
- POJ 3321 Apple Tree(树状数组)
Apple Tree Time Limit: 2000MS Memory Lim ...
- CF 161D Distance in Tree 树形DP
一棵树,边长都是1,问这棵树有多少点对的距离刚好为k 令tree(i)表示以i为根的子树 dp[i][j][1]:在tree(i)中,经过节点i,长度为j,其中一个端点为i的路径的个数dp[i][j] ...
- Segment Tree 扫描线 分类: ACM TYPE 2014-08-29 13:08 89人阅读 评论(0) 收藏
#include<iostream> #include<cstdio> #include<algorithm> #define Max 1005 using nam ...
- Size Balanced Tree(SBT) 模板
首先是从二叉搜索树开始,一棵二叉搜索树的定义是: 1.这是一棵二叉树: 2.令x为二叉树中某个结点上表示的值,那么其左子树上所有结点的值都要不大于x,其右子树上所有结点的值都要不小于x. 由二叉搜索树 ...
随机推荐
- Java异步调用Future对象
Future类存在于JDK的concurrent包中,主要用途是接收Java的异步线程计算返回的结果. 个人理解的使用场景大概如下: 有两个任务A和B,A任务中仅仅需要使用B任务计算成果,有两种方法实 ...
- OPStackComputeNodeMaintain
1,yum -y install openstack-nova-compute计算节点配置完成后 其配置文件默认非注释行内容如下;
- 用特殊字体来实现矢量ICON
用特殊字体来实现矢量ICON tips:其实每个icon都是一个unicode字符,所以,可以通过改变font-size实现icon的矢量放大:可以通过改变color实现多色系.
- PHP 后台程序配置config文件,及form表单上传文件
一,配置config文件 1获取config.php文件数组, 2获取form 表单提交的值 3保存更新config.php文件,代码如下: $color=$_POST['color']; $back ...
- c++面试知识点
static #include<stdio.h> #include<iostream> #include<assert.h> using namespace std ...
- iOS更新之DFU模式和恢复模式
DFU模式和恢复模式的区别:DFU模式是在iPhone固件引导启动之前进行恢复的模式.所以用DFU模式刷机一般比较干净,不会有任何垃圾文件.想当于电脑重新格式化之后再安装系统. DFU模式进入方法:1 ...
- iPhone图形开发绘图小结
iPhone图形开发绘图教程是本文要介绍的内容,介绍了很多关于绘图类的使用,先来看详细内容讲解. 1.绘图总结: 绘图前设置: CGContextSetRGBFillColor/CGContextSe ...
- 曾经很长时间不会写的两个SQL语句(group by,having)
1.统计各部门的平均工资,平均资金(要求同时显示出部门名称,部门编号,部门总人数) SQL)),) 部门平均工资,)),) 部门平均资金 FROM EMP E RIGHT JOIN DEPT D ON ...
- 自定义上传按钮 <input type="file" name = "file"/> (将file隐藏在button下)
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- js简单排序
简单的排序功能 HTML代码: <body> <input id="btn1" type="button" value="排序&qu ...