[英]Javascript implementation of interval search tree
Is there a boost ICL equivalent interval search tree in javascript? javascript中是否存在Boost ICL等效间隔搜索树? I am new to javascript.
我是javascript新手。 What's the best way to find optimised data structure implementations for javascript?
为javascript找到优化的数据结构实现的最佳方法是什么?
Application: The requirement is to get US based zip-codes as input and return the name of state (as string) containing the zip-code as output. 应用程序:要求是获取基于美国的邮政编码作为输入,并返回包含该邮政编码的状态名称(作为字符串)作为输出。 Eg: input: 95630, output: "CA" I thought an interval search tree would be a nice way to search for state quickly.
例如:输入:95630,输出:“ CA”我认为间隔搜索树将是一种快速搜索状态的好方法。 I can store the zipcode range as the range of the interval in each node and the value as a string containing the state name in string in the node.
我可以将邮政编码范围存储为每个节点中间隔的范围,并将值存储为节点中包含状态名称的字符串。
I don't know what boost icl is but there are a few interval trees for js. 我不知道boost icl是什么,但是js有一些间隔树。 Here is one.
这是一个。
https://www.npmjs.com/package/node-interval-tree https://www.npmjs.com/package/node-interval-tree
I think there is at least one zip code with two states, and I'm not sure it's at a border case. 我认为至少有一个带有两种状态的邮政编码,但我不确定它是否处于边界情况。 I haven't done zip codes in a long time but this zip code (somewhere on the east coast) caused issues for most of the devs.
我已经很长时间没有使用邮政编码了,但是这个邮政编码(在东海岸的某个地方)对大多数开发人员造成了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.