zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    NYOJ 205
    NYOJ 187
    NYOJ 105
    NUOJ 88
    NYOJ 70
    LL(1)算法
    MATLAB的一些基础知识
    Ubuntu raid5+lvm实验
    空间滤波
    认识weblogic的各个机构
  • 原文地址:https://www.cnblogs.com/ireneyanglan/p/4865641.html
Copyright © 2011-2022 走看看