mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
82291c21ad
13
README.md
13
README.md
|
@ -177,6 +177,7 @@ In interpolation-sequential search, interpolation is used to find an item near t
|
||||||
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Interpolation_search)
|
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Interpolation_search)
|
||||||
|
|
||||||
## Jump Search
|
## Jump Search
|
||||||
|
![alt text][JumpSearch-image]
|
||||||
In computer science, a jump search or block search refers to a search algorithm for ordered lists. It works by first checking all items Lkm, where {\displaystyle k\in \mathbb {N} } k\in \mathbb {N} and m is the block size, until an item is found that is larger than the search key. To find the exact position of the search key in the list a linear search is performed on the sublist L[(k-1)m, km].
|
In computer science, a jump search or block search refers to a search algorithm for ordered lists. It works by first checking all items Lkm, where {\displaystyle k\in \mathbb {N} } k\in \mathbb {N} and m is the block size, until an item is found that is larger than the search key. To find the exact position of the search key in the list a linear search is performed on the sublist L[(k-1)m, km].
|
||||||
|
|
||||||
The optimal value of m is √n, where n is the length of the list L. Because both steps of the algorithm look at, at most, √n items the algorithm runs in O(√n) time. This is better than a linear search, but worse than a binary search. The advantage over the latter is that a jump search only needs to jump backwards once, while a binary can jump backwards up to log n times. This can be important if a jumping backwards takes significantly more time than jumping forward.
|
The optimal value of m is √n, where n is the length of the list L. Because both steps of the algorithm look at, at most, √n items the algorithm runs in O(√n) time. This is better than a linear search, but worse than a binary search. The advantage over the latter is that a jump search only needs to jump backwards once, while a binary can jump backwards up to log n times. This can be important if a jumping backwards takes significantly more time than jumping forward.
|
||||||
|
@ -283,14 +284,16 @@ where {\displaystyle \oplus } \oplus denotes the exclusive disjunction (XOR) op
|
||||||
[topological-wiki]: https://en.wikipedia.org/wiki/Topological_sorting
|
[topological-wiki]: https://en.wikipedia.org/wiki/Topological_sorting
|
||||||
|
|
||||||
[linear-wiki]: https://en.wikipedia.org/wiki/Linear_search
|
[linear-wiki]: https://en.wikipedia.org/wiki/Linear_search
|
||||||
[linear-image]: http://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif
|
[linear-image]: http://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif "Linear Search"
|
||||||
|
|
||||||
[binary-wiki]: https://en.wikipedia.org/wiki/Binary_search_algorithm
|
[binary-wiki]: https://en.wikipedia.org/wiki/Binary_search_algorithm
|
||||||
[binary-image]: https://upload.wikimedia.org/wikipedia/commons/f/f7/Binary_search_into_array.png
|
[binary-image]: https://upload.wikimedia.org/wikipedia/commons/f/f7/Binary_search_into_array.png "Binary Search"
|
||||||
|
|
||||||
|
|
||||||
[caesar]: https://upload.wikimedia.org/wikipedia/commons/4/4a/Caesar_cipher_left_shift_of_3.svg
|
[caesar]: https://upload.wikimedia.org/wikipedia/commons/4/4a/Caesar_cipher_left_shift_of_3.svg "Caesar"
|
||||||
|
|
||||||
[ROT13-image]: https://upload.wikimedia.org/wikipedia/commons/3/33/ROT13_table_with_example.svg
|
[ROT13-image]: https://upload.wikimedia.org/wikipedia/commons/3/33/ROT13_table_with_example.svg "ROT13"
|
||||||
|
|
||||||
[QuickSelect-image]: https://upload.wikimedia.org/wikipedia/commons/0/04/Selecting_quickselect_frames.gif
|
[JumpSearch-image]: https://i1.wp.com/theoryofprogramming.com/wp-content/uploads/2016/11/jump-search-1.jpg "Jump Search"
|
||||||
|
|
||||||
|
[QuickSelect-image]: https://upload.wikimedia.org/wikipedia/commons/0/04/Selecting_quickselect_frames.gif "Quick Select"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user