Jump Search in Python

python_tutorials

Introduction

Finding the right data we need is an age-old problem before computers. As developers, we create many search algorithms to retrieve data efficiently.

Search algorithms can be divided into two broad categories: sequential and interval searches. Sequential searches check each element in a data structure. Interval searches check various points of the data (called intervals), reducing the time it takes to find an item, given a sorted dataset.

In this article, you will cover Jump Search in Python – a hybrid combination of sequential search and interval search on sorted arrays.

Jump Search

With Jump Search, the sorted array of data is split into subsets of elements called blocks. We find the search key (input value) by comparing the search candidate in each block. As the array is sorted, the search candidate is the highest value of a block.

When comparing the search key to a

 

 

To finish reading, please visit source site