Algorithms are instructions for solving specific problems. At a basic level, we can think of an algorithm as a cookbook, because it describes the steps of how to produce a finished dish from the input ingredients quite precisely.
In programming, there are whole families of algorithms that are useful for solving different types of problems. However, if you're looking for tutorials on how to tackle app design as a whole, you'll need to reach for more powerful tools such as design patterns.
The approximate distance of two GPS points as the crow flies can be easily calculated by the algorithm:
PHP implementation
function getCoordsDistance(
float $lat1,
float $lng1,
float $lat2,
float $lng2
): float {
$r = 6371;
$lat1 = ($lat1 /…
The principle of most document fingerprinting hashing functions is that they always return the same output for every single input. This is called deterministic behavior. At the same time, a small change in the input will cause a large change in the…
Each algorithm has its own complexity, which can be expressed in mathematical notation. This overview shows the typical complexity of algorithms according to the size of the input data (i.e. the number of elements they work with) and which types of…
There is no easy way to validate and format phone numbers in PHP, so I wrote a simple library that has no dependencies, but can still handle this role.
The goal is to check the format of a phone number, or convert it to a basic canonical form (which…
In the past, this article has described methods to recognize similar numbers.
For example, 500 199 Kč and 500 210 Kč are almost the same.
The solution is to calculate the proportion and compare against epsilon.
$x = 500199;
$y = 500210;
$epsilon = 0…
Captcha is currently one of the most common ways to protect free formats. It was originally created not to protect data security, but to protect against spam and to recognize that it is a human.
However, it is machine-generated so it is not always…