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", ...}
]
this data set is characterized by the fact that individual data are clustered together according to their own type. Also, the collection whose type is point must precede the line, and similarly, the collection of line must precede the area.
now it"s time to insert a new piece of data, type as" area", insert into the first item of the area collection. Is there any other search algorithm that can be faster than sequential search? Thank you