Basic algorithms and their implementation