A Novel Algorithm based on Entanglement Measurement for Improving Speed of Quantum Algorithms