K-d Tree in TripAdvisor

Source: Internet
Author: User

Today, TripAdvisor held a tech talk in Columbia University. The topic is on 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 the 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 the axis cycles through all V Alid 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.