data = [
{type: 'point', ...},
{type: 'point', ...},
{type: 'point', ...},
{type: 'point', ...},
{type: 'point', ...},
{type: 'point', ...},
{type: 'line', ...},
{type: 'line', ...},
{type: 'line', ...},
{type: 'line', ...},
{type: 'area', ...},
{type: 'area', ...},
{type: 'area', ...},
{type: 'area', ...},
{type: 'area', ...}
]这个数据集合的特征是,各个数据按照各自的type聚集在一起。并且,type为point的集合一定会在line前面,同理,line的集合一定会在area前面。
现在要插入一条新的数据,type为'area',插入到area集合的第一项里,除了顺序查找,有没有别的查找算法能快一点?谢谢
qq_花开花谢_0
相关分类