New and improved search algorithms and precise analysis of their average-case complexity
In this paper, we consider the searching problem over ordered sequences. It is well known that Binary Search (BS) algorithm solves this problem with very efficient complexity, namely with the complexity θ(log2n). The developments of the BS algorithm, such as Ternary Search (TS) algorithm do not impr...
Saved in:
| Published in: | Future generation computer systems Vol. 95; pp. 743 - 753 |
|---|---|
| Main Authors: | , , |
| Format: | Journal Article |
| Language: | English |
| Published: |
Elsevier B.V
01.06.2019
|
| Subjects: | |
| ISSN: | 0167-739X, 1872-7115 |
| Online Access: | Get full text |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| Summary: | In this paper, we consider the searching problem over ordered sequences. It is well known that Binary Search (BS) algorithm solves this problem with very efficient complexity, namely with the complexity θ(log2n). The developments of the BS algorithm, such as Ternary Search (TS) algorithm do not improve the efficiency. The rapid increase in the amount of data has made the search problem more important than in the past. And this made it important to reduce average number of comparisons in cases where the asymptotic improvement is not achieved. In this paper, we identify and analyze an implementation issue of BS. Depending on the location of the conditional operators, we classify two different implementations for BS which are widely used in the literature. We call these two implementations weak and correct implementations. We calculate precise number of comparisons in average case for both implementations. Moreover, we transform the TS algorithm into an improved ternary search (ITS) algorithm. We also propose a new Binary–Quaternary Search (BQS) algorithm by using a novel dividing strategy. We prove that an average number of comparisons for both presented algorithms ITS and BQS is less than for the case of correct implementation of the BS algorithm. We also provide the experimental results.
•We propose improved ternary search (ITS) algorithm.•We also propose a new Binary–Quaternary Search (BQS) algorithm.•We discuss weak and correct implementations of the binary search (BS) algorithm.•We calculate average number of comparisons for weak and correct implementations of the BS algorithm precisely.•We calculate average number of comparisons for the ITS and BQS algorithms precisely. |
|---|---|
| ISSN: | 0167-739X 1872-7115 |
| DOI: | 10.1016/j.future.2019.01.043 |