Implementation of a Controlled-Phase Gate and Deutsch-Jozsa Algorithm with Superconducting Charge Qubits in a Cavity