Efficient Design of Sparse Arrays for Narrowband and Wideband Beamforming