/* PHP & MySQL Journal */
In: algorithms| data| php
10 Dec 2009Sorting PHP arrays using usort with substrings
In: algorithms| php
20 Sep 2009auto generation of upc check digit
In: algorithms
13 Jul 2009linked list in php
In: algorithms| php
20 Apr 2009In this post we will see how to use a Stemming algorithm for search purposes.
A stemming algorithm lets you reduce each English input word to its basic root or stem (e.g. ‘walking’ to ‘walk’) so that variations on a word (‘walks’, ‘walked’, ‘walking’) are considered equivalent when searching. This stems can than be used [...]
In: algorithms
8 Jan 2009I recently wrote a quick code to find if a numeric array is ordered i.e sorted in a ascending or descending order. I needed it to check a sort algorithm I had written. The problem is that the following code has a worst-case running time of O(N). Can we make the running time logarithmic.
In: algorithms| php
9 Jul 2008The Luhn algorithm also known as the “modulus 10″ or “mod 10″ algorithm, is a checksum formula which can be used to validate credit card numbers. Developed in the 1950’s by IBM scientist Hans Peter Luhn and described in U.S. Patent 2,950,048. A PHP implementation is shown below.
function LuhnCheck($strDigits)
{
$sum = 0;
[...]
In: algorithms| php
24 Jun 2008Data structures are one of the core elements of computer science and they are also fun to program. But being a web developer the opportunity for implementing them in any application is quite rare. But then I thought, What the heck! I can just code for the joy of it, and it will also help [...]