I'm wondering if inserting an integer into a sorted list (in a way that the list remains sorted) can be performed in Mathematica in some fancy way in $\log(N)$ time?..
The question was asked here, but I'm not sure if any of realizations presented there work in $\log(N)$. I would appreciate if anyone provided the solution for not simply a list, but for a list of lists sorted by their certain element. E.g.:
ins[{{1,b},{3,{}},{14,"hi!"}},{6,0}]
gives:
{{1,b},{3,{}},{6,0},{14,"hi!"}}
Where sorting was performed by the first field of the sublist.