Algorithms for the Optimization of Quantum Circuits