The following two examples show the problem with common search interfaces when there are multiple pages.


« previous 1 2 … 118 119 120 121 122 123 124 125 126 … 129 130 next »


What happens if I want page 50? I invite you to try it.

Pathological example

Here is the display. enter image description here


What if I want page 300? Again I invite you to try.

A solution using simple binary search

Use a classic binary search. Always round down.

< 1 ... 49,50,51 ... 100 >

You click on the ellipsis (or the nearest number) between the limits you are interested in and you see a new selection. So, suppose I want page 80. I click on the right-most ellipsis and get:

< 51 ... 74,75,76 ... 100 >


< 76 ... 87,88,89 ... 100 >

< 76 ... 80,81,82 ... 87 >

Then click on 80.

The whole thing takes 4 clicks. It also scales very well (1 million pages would require a maximum of 20 clicks to reach any single page). It can easily be made more intuitive by also allowing clicking on the nearest number to your destination.


Is there a technical (or other good) reason that web developers don't use a binary search as I showed? It is a classic algorithm and is easy to implement in a dozen lines of code.


Binary search works on sorted arrays. Binary search begins by comparing the middle element of the array with the target value. If the target value matches the middle element, its position in the array is returned. If the target value is less than the middle element, the search continues in the lower half of the array. If the target value is greater than the middle element, the search continues in the upper half of the array. By doing this, the algorithm eliminates the half in which the target value cannot lie in each iteration. https://en.wikipedia.org/wiki/Binary_search_algorithm

closed as primarily opinion-based by JonW Dec 3 '18 at 13:35

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I get what you are suggesting, however my area of concern would be narrowing down the search in the first place. If there are 100+ pages of results, that tells me the search isn't working very well. – DarrylGodden Dec 3 '18 at 13:26
  • @DarrylGodden - How do you suggest narrowing the search? Particularly in my first example? I sometimes want to refer back to a previous part of the conversation. – chasly from UK Dec 3 '18 at 13:34
  • 1
    This isn't really a question that we can provide a solution to. It's a bit too subjective and covered by our What Not To Ask guide as more of a rant in disguise ("X sucks, am i right?"). It might suit a more discussion based site, but not really a Q&A site such as Stack Exchange. – JonW Dec 3 '18 at 13:35
  • Well that's too wide ranging for here, I would need to understand the website, product and proposition, but the comment still stands. – DarrylGodden Dec 3 '18 at 13:36
  • 1
    Probably a combination of many users don't know what a binary search is (or designers don't think they will know) and presentation: I suspect clicking on the ellipsis isn't a "normal" thing, so people won't think to do it. Also, without fore-knowledge/training, users probably won't realise that clicking on 51 doesn't just mean "show page 51" but also means "show pages 51 to 100". With a suitably designed layout, I think the idea could have legs. – TripeHound Dec 3 '18 at 16:13