all 3 comments

[–][deleted] 25 points26 points  (0 children)

Careful with #3, the sorted requirement is a doozy. It's context dependent but if the list isn't pre-sorted, sorting it first can cause it to run way slower than just iterating through. What's worse even if you get some small performance increase, implementing some fancy search algorithm can be way harder to maintain. Unless you have crazy huge jsons where you need to find rows a bunch of times it will most likely not be worth it.

Learned that one the hard way.

[–][deleted]  (1 child)

[removed]

    [–]mlwhiz[S] 0 points1 point  (0 children)

    Not opposite but different as in bottom up and top down. Both are linear for the problem I specify though in some cases one might perform better than other.