Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
Python Zone is brought to you in partnership with:

Algorithms

  • submit to reddit
Stoimen Popov05/09/12
6176 views
0 replies

Algorithm of the Week: Determine if a Number is Prime

Stoimen Popov is back with another episode in his Algorithm of the Week series, and this week he tackles prime numbers. Stoimen begins with a very basic (brute force) approach, and then refines his algorithm to be far more effective, though it still works best for smaller numbers.

Stoimen Popov04/24/12
7875 views
3 replies

Algorithm of the Week: How to Determine the Day of the Week

Do you know what day of the week was the day you were born? Monday or maybe Saturday? What about January 31st, 1883? Well, Stoimen Popov has created this post to explain a useful algorithm for determining what day of the week a certain date falls on.

Stoimen Popov04/11/12
9025 views
0 replies

Algorithm of the Week: Morris-Pratt String Searching

Stoimen Popov returns with his Algorithm of the Week series, and in this post, he tackles the task of improving on the Brute Force String Matching and Rabin-Karp Sting Searching algorithms. To do this, he examines the flaws in the previous two, and explains how the Morris-Pratt String Searching algorithm can do better.

Stoimen Popov04/03/12
8329 views
0 replies

Algorithm of the Week: Rabin-Karp String Searching

Last week, Stoimen Popov explained Brute Force String Matching, but cautioned that it is not the most efficient method for pattern matching. In this post, Stoimen breaks down a more efficient method, the Rabin-Karp Algorithm, and explains why it is more efficient in practice than in theory.

Stoimen Popov03/27/12
7296 views
0 replies

Algorithm of the Week: Brute Force String Matching

When it comes to string matching, the most basic approach is what is known as brute force, which simply means to check every single character from the text to match against the pattern. In this post, Stoimen Popov explains the principles behind Brute Force String Matching, demonstrates its implementation, and shows you what cases it is best used for.

Jose Asuncion03/25/12
3880 views
0 replies

My Implementation of the Apriori Algorithm

This is a self imposed machine problem written for a lesson lesson on Frequent Itemsets and the Apriori Algorithm. The program that would find the top five frequent item sets among a set of baskets.

Stoimen Popov03/21/12
5297 views
0 replies

Algorithm Cheatsheet: Radix Sort

Radix sort is an elegant and fast integer-sorting algorithm as explained in the following cheatsheet. In this post, Stoimen has provided an Algorithm Cheatsheet to help you out!

Stoimen Popov03/20/12
6760 views
0 replies

Algorithm of the Week: Radix Sort

Stoimen Popov continues his series on Algorithms, this week tackling Radix Sort. In this post, Stoimen explains the implementation of Radix Sort using PHP, and provides a Pros and Cons list to help you decide if Radix Sort is right for your situation.

Jose Asuncion03/18/12
3957 views
0 replies

The Apriori Algorithm

The Apriori algorithm is a basic method for finding frequent itemsets. The latter is used to generate association rules with high confidence and high interest. Here is my summary of it along with a running example. The following set of baskets will be used:

Stoimen Popov03/13/12
5904 views
1 replies

Algorithm of the Week: Quicksort

In general Quicksort consists of some very simple steps. First we have to choose an element from the list (called a pivot) then we must put all the elements with a value less than the pivot on the left side of the pivot and all the items with value greater than the pivot on its right side. After that we must repeat these steps for the left and the right sub-lists. As Stoimen Popov explains, that is Quicksort! Simple and elegant!

Stoimen Popov01/31/12
6569 views
0 replies

Algorithm of the Week: Data Compression with Relative Encoding

I will show you how you can save space for certain implementations by reducing the amount of characters you are encoding using relative encoding.

Stoimen Popov01/24/12
9918 views
1 replies

Algorithm of the Week: Data Compression with Diagram Encoding and Pattern Substitution

Two variants of run-length encoding are the diagram encoding and the pattern substitution algorithms. The diagram encoding is actually a very simple algorithm.

Stoimen Popov01/17/12
5192 views
0 replies

Algorithm of the Week: Data Compression with Bitmaps

In my previous post we saw how to compress data consisting of very long runs of repeating elements. This type of compression is known as “run-length encoding” and can be very handy when transferring data with no loss. The problem is that the data must...

Stoimen Popov01/10/12
3779 views
1 replies

Algorithm of the Week: Data Compression with Run-length Encoding

No matter how fast today’s computers and networks are, the users will constantly need faster and faster services. To reduce the volume of the transferred data we usually use some sort of compression. That is why this computer sciences area will be always...

Stoimen Popov01/03/12
6023 views
2 replies

Algorithm of the Week: Interpolation Search

I wrote about binary search in my previous post, which is indeed one very fast searching algorithm, but in some cases we can achieve even faster results. Such an algorithm is the “interpolation search” – perhaps the most interesting of all searching...