We have designed efficient quantum circuits for the three-qubit Toffoli (controlled-controlled NOT) and the Fredkin (controlled-SWAP) gate, optimized via genetic programming methods. The gates thus obtained were experimentally implemented on a three-qubit NMR quantum information processor, with a high fidelity. Toffoli and Fredkin gates in conjunction with the single-qubit Hadamard gates form a universal gate set for quantum computing, and are an essential component of several quantum algorithms. Genetic algorithms are stochastic search algorithms based on the logic of natural selection and biological genetics and have been widely used for quantum information processing applications. The numerically optimized rf pulse profiles of the three-qubit quantum gates achieve $> 99%$ fidelity. The optimization was performed under the constraint that the experimentally implemented pulses are of short duration and can be implemented with high fidelity. Therefore the gate implementations do not suffer from the drawbacks of rf offset errors or debilitating effects of decoherence during gate action. We demonstrate the advantage of our pulse sequences by comparing our results with existing experimental schemes.