Optimization of Quantum Algorithms for Applications