Algorithm pseudo-implementation