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', ...}
]這個數(shù)據(jù)集合的特征是,各個數(shù)據(jù)按照各自的type聚集在一起。并且,type為point的集合一定會在line前面,同理,line的集合一定會在area前面?,F(xiàn)在要插入一條新的數(shù)據(jù),type為'area',插入到area集合的第一項里,除了順序查找,有沒有別的查找算法能快一點?謝謝
這個查找應該用什么算法?
慕哥9229398
2019-01-02 22:27:57