In the post “Sieve of Eratosthenes“, I had posted a Java program for the prime sieve. Translating it to Python, I have: The list of primes generated by this sieve could then be used for…
Posts for: #Algorithms
0x0012 - Fibonacci sequence – Part 2
In this post we’ll compare the various methods of generating Fibonacci sequence terms and implementing the code to recognize Fibonacci terms and to determine index of these terms. These…
0x0011 - Fibonacci sequence
The Fibonacci sequence in mathematics is the following sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 … Representation By definition, the first two terms are 0…
0x0010 - Searching Algorithms – Part 3
Uniform Binary Search I came across the uniform binary search algorithm in The Art Of Computer Programming – Volume 3: Sorting and Searching as an optimization of the binary search,…
0x000f - Searching Algorithms – Part 2
Binary Search The binary search algorithm, a variation of the Dichotomic search, finds the position of a specified “key” within a sorted list/array using the divide and conquer approach.…
0x000e - Searching Algorithms – Part 1
This is the first part of some searching algorithms that I’m implementing. The algorithms are: Linear Search Binary Search Uniform Binary Search Fibonacci Search Jump Search…
0x000d - Project Euler 011
Problem: In the 20 x 20 grid below, four numbers along a diagonal line have been marked. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40…
0x000c - Project Euler 010
Problem: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. Solution: 1. Brute-force approach: 2. Efficient approach (using the Sieve…