自组织序列策略
谁能给我任何可用于使序列成为自组织序列的策略?
假设序列包含整数值。
编辑:自组织是指通过搜索模式排列元素。
例如,
如果我们有序列:12, 11, 4, 13, 10
,因为它未排序,我们无法执行二分搜索。我们必须执行线性搜索以检查序列是否包含特定键。
因此,通过自组织,我的意思是以某种方式重新排列序列以使线性搜索更有效。
我可以想到两个 - 基于搜索的优先级排序,对列表进行排序,然后执行二分搜索而不是线性搜索。有人还有其他想法吗?
Can anyone give me any strategies that can be used to make a sequence a self-organising sequence?
Assume the sequence contains integer values.
EDIT: By self-organising I mean arranging elements by search patterns.
e.g.
if we have the sequence: 12, 11, 4, 13, 10
as it it unsorted, we cannot perform binary search. We must perform linear search in order to check if the sequence contains a particular key.
Therefore, by self-organising, I mean somehow rearranging the sequence to make the linear search more efficient.
I can think of two - priority ordering based on searches, and sorting the list and then performing binary search instead of linear search. Anyone got any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一些研究,我实际上发现了三种正式策略:
1)移至前面:每当访问时将搜索到的项目移动到序列的前面
2)迁移到前面:每当访问时将搜索到的项目移动到序列的前面
3)频率表:根据访问/搜索频率对项目进行排序
There are actually three formal strategies I found after some research:
1) Move To Front: Move searched item to the front of the sequence whenever accessed
2) Migrate To Front: Move searched item one place up the sequence whenever accessed
3) Frequency Tables: Order items based on frequency of accesses/searches