  We present a method for estimating the density of states of a classical
statistical model. The algorithm successfully combines the Wang-Landau flat
histogram method with the N-fold way in order to improve efficiency of the
original single spin flip version. We test our implementation of the
Wang-Landau method with the two-dimensional nearest neighbor Ising model for
which we determine the tunneling time and the density of states. Furthermore,
we show that our new algorithm performs correctly at right edges of an energy
interval over which the density of states is computed. This removes a
disadvantage of the original single spin flip Wang-Landau method where results
showed systematically higher errors in the density of states at right
boundaries. We compare our data with the detailed numerical tests presented in
a study by Wang and Swendsen where the original Wang-Landau method was tested
against various other methods. Finally, we apply our method to a thin Ising
film of size $32\times 32\times 6$ with antisymmetric surface fields. With the
density of states obtained from the simulations we calculate canonical averages
related to the energy such as internal energy, Gibbs free energy and entropy,
but we also sample microcanonical averages during simulations in order to
determine canonical averages of the susceptibility, the order parameter and its
fourth order cumulant. We compare our results with simulational data obtained
from a conventional MC algorithm.
