This tutorial will show you how the Selection Sort algorithm works. It is mostly used to sort numbers, but you can sort letters as well using the ASCII numeration. It also has examples that demonstrates algorithm. All the code examples are written in C++.
Have you ever thought about the fastest way to sort N numbers?
Last week I wrote a post about the fastest way to sort 3 numbers, this week I show you a tricky way to optimize the sort of N numbers.
The problem of sorting an...
This is a variant of selection sort without using for-statements. Do you like it? :-)
The recipe illustrates a Python implementation of the bitsort algorithm. This algorithm is illustrated in the book "Programming Pearls" by Jon Bentley. The bitsort algorithm provides a very efficient way to sort large numbers in disk files.
This is an evolutionary algorithm that returns a random list of prime numbers. This code is highly inefficient for a reason. This algorithm is more of a proof of concept that if a prime was a heritable trait, it would not be a desired one.
I wrote this after reading The Alphanum Algorithm (http://www.davekoelle.com/alphanum.html) by David Koelle a few years ago; my goal was to improve the performances of the Python version of his scripts.
My version is approximatly 10...
a python version of heap sort
This is a pure Python implementation of the rsync algorithm. On my desktop (3.0GHz dual core, 7200RPM), best case throughput for target file hash generation and delta generation is around 2.9MB/s. Absolute worst case scenario (no blocks in common)...
A-star (A*) Shortest Path Algorithm
Dijkstra shortest path algorithm.
Given items that depend on other items, a topological sort arranges items in order that no one item precedes an item it depends on. In this example items are strings and dependencies are expressed in a dictionary whose keys are items and...
Floyd-Steinberg dithering is an image dithering algorithm (see http://en.wikipedia.org/wiki/Floyd-Steinberg for more details). While the algorithm is mainly for image manipulation, I use it to create random locations for sensor networt devices.
A function which implements sort keys for the german language according to DIN 5007.
Sort Data Table script provides you options to dynamically sort data contained in a table.
This is a simple implementation of the famous LZW algorithm.
this algorithm predicts the received signal strength for the mobile user to avoid fluctuation in received signal strength during localization of the mobile user(finding mobile user's location)
NSGA-II is a very famous multi-objective optimization algorithm. I submitted an example previously and wanted to make this submission useful to others by creating it as a function. Even though this function is very specific to benchmark problems,...
Gravitational search algorithm (GSA) is an optimization algorithm based on the law of gravity and mass interactions.This algorithm is based on the Newtonian gravity: "Every particle in the universe attracts every other particle with a force...
The Jonker-Volgenant algorithm is much faster than the famous Hungarian algorithm for the Linear Assignment Problem (LAP). This Matlab implementation is modified from the original C++ code made by Roy Jonker, one of the inventors of the algorithm....
A flexible implementation of PSO algorithm with time-varying parameters. Algorithm is suitable for solving continuous optimization problems. Special care has been taken to enable flexibility of the algorthm with respect to its parameters and to... |