From cf31efb53f7442c60cd1ac315770fe503817971d Mon Sep 17 00:00:00 2001 From: TobiDueces <44579378+TobiDueces@users.noreply.github.com> Date: Mon, 29 Oct 2018 22:42:00 +0530 Subject: [PATCH 1/3] Update README.md (#553) --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b96ef8655..55574a8b7 100644 --- a/README.md +++ b/README.md @@ -283,14 +283,14 @@ where {\displaystyle \oplus } \oplus denotes the exclusive disjunction (XOR) op [topological-wiki]: https://en.wikipedia.org/wiki/Topological_sorting [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-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 +[QuickSelect-image]: https://upload.wikimedia.org/wikipedia/commons/0/04/Selecting_quickselect_frames.gif "Quick Select" From fa86d3d95473cb95445f1ff31b9eef5c797571fd Mon Sep 17 00:00:00 2001 From: TobiDueces <44579378+TobiDueces@users.noreply.github.com> Date: Mon, 29 Oct 2018 22:53:24 +0530 Subject: [PATCH 2/3] Add Jump Search image (#552) * Add Jump Search image * Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 55574a8b7..af9c26a9f 100644 --- a/README.md +++ b/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) ## 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]. 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. @@ -293,4 +294,6 @@ where {\displaystyle \oplus } \oplus denotes the exclusive disjunction (XOR) op [ROT13-image]: https://upload.wikimedia.org/wikipedia/commons/3/33/ROT13_table_with_example.svg "ROT13" +[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" From 75d11f9034552685b390054a4a7083766a649caa Mon Sep 17 00:00:00 2001 From: Kushal Naidu Date: Tue, 30 Oct 2018 19:08:44 +0530 Subject: [PATCH 3/3] Correctly check for squares of primes (#549) As the for-loop was looping by two numbers, it would stop at 1 number less than the root of prime squares, resulting it in incorrectly classifying the squares as prime numbers. Incrementing the loop ensures the next number is also considered resulting in accurate classification. --- maths/PrimeCheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/PrimeCheck.py b/maths/PrimeCheck.py index 79fd343db..9a75a978c 100644 --- a/maths/PrimeCheck.py +++ b/maths/PrimeCheck.py @@ -1,6 +1,6 @@ def primeCheck(number): prime = True - for i in range(2, int(number**(0.5)+1), 2): + for i in range(2, int(number**(0.5)+2), 2): if i != 2: i = i - 1 if number % i == 0: