I have written an algorithm, wich can order and sort large numbers of items.
It creates a pyramidal directory, moving entries and groups accordingly.
Items can be added, removed and even kept sorted in real-time.
This is the standard-implentation. Do also have a look at Clusters-Runtime,
the Windows-Runtime-Component of Clusters!
Principle
The entries are stored in groups.
The size of the groups is limited and 10 by default.
If the group is full a parentgroup is created.
The first and the last entry can be moved to the neighbour-group.
The entries are moved between the groups, so all groups get as full as possible.
The number of groups is limited too, another parentgroup is created.
If an entry needs to be inserted in a full group, a whole subtree can be moved.