arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.16729cs.DS
收藏

优化搜索策略:双指针线性搜索实现研究

Optimizing Search Strategies: A Study of Two-Pointer Linear Search Implementation

Nazma Akter Zinnia, Eisuke Hanada

AI总结:

本研究对比三种基础搜索算法的复杂度与性能,提出一种新型双指针搜索实现,经多硬件测试验证其效率显著提升,可适配有序与无序数据集,后续将拓展至更复杂场景。

摘要:

本报告探究了三种基础搜索算法:Linear Search(线性搜索)、Binary Search(二分搜索)和Two Pointer Search(双指针搜索)。Linear Search按顺序检查每个元素,Binary Search将搜索空间对半划分,Two Pointer Search使用两个指针从有序列表的两端开始扫描。我们从时间复杂度、空间复杂度和实际性能三个方面对这些算法进行了比较。研究结果表明,Linear Search虽然实现简单,但在处理大型数据集时效率低下;Binary Search对有序数据的搜索效率高,但需要预先进行排序步骤;融合了两种方法特点的Two Pointer Search在简洁性和效率之间实现了实用的平衡。我们提出了一种全新的Two Pointer Search算法实现方式,并通过在多种硬件配置上开展全面测试验证了其性能。结果显示,我们提出的算法显著提升了搜索效率,既适用于有序数据集,也适用于无序数据集。未来的工作将把该算法拓展到更复杂的数据结构和实际应用场景中。

英文摘要:

This report investigates three fundamental search algorithms: Linear Search, Binary Search, and Two Pointer Search. Linear Search checks each element sequentially, Binary Search divides the search space in half, and Two Pointer Search uses two pointers to scan from both ends of a sorted list. We compare these algorithms in terms of time complexity, space complexity, and practical performance. Our findings demonstrate that while Linear Search is straightforward, it is inefficient for large datasets. Binary Search is efficient for sorted data but requires an initial sorting step. The Two Pointer Search, combining elements of both methods, offers a practical balance of simplicity and efficiency. We propose a novel implementation of the Two Pointer Search algorithm and validate its performance through comprehensive testing on various hardware configurations. The results indicate that our proposed algorithm significantly improves search efficiency, making it suitable for both sorted and unsorted datasets. Future work will extend this algorithm to more complex data structures and real-world applications.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑