  In this paper we are concerned with numerical methods for nonhomogeneous
Helmholtz equations in inhomogeneous media. We design a least squares method
for discretization of the considered Helmholtz equations. In this method, an
auxiliary unknown is introduced on the common interface of any two neighboring
elements and a quadratic subject functional is defined by the jumps of the
traces of the solutions of local Helmholtz equations across all the common
interfaces, where the local Helmholtz equations are defined on elements and are
imposed Robin-type boundary conditions given by the auxiliary unknowns. A
minimization problem with the subject functional is proposed to determine the
auxiliary unknowns. The resulting discrete system of the auxiliary unknowns is
Hermitian positive definite and so it can be solved by the PCG method. Under
some assumptions we show that the generated approximate solutions possess
almost the optimal error estimates with little "wave number pollution".
Moreover, we construct a substructuring preconditioner for the discrete system
of the auxiliary unknowns. Numerical experiments show that the proposed methods
are very effective for the tested Helmholtz equations with large wave numbers.
