Implemented all gates and Deutsch's algorithm