We simulate the growth of large-scale structure for three different co
smological models, an Einstein-de Sitter model (density parameter Omeg
a(0) = 1), an open model (Omega(0) = 0.2), and a flat model with nonze
ro cosmological constant (Omega(0) = 0.2, cosmological constant lambda
(0) = 0.8), using a cosmological N-body code (particle-particle/partic
le-mesh) with 64(3) dark matter particles in a comoving cubic volume o
f present comoving size 128 Mpc. The calculations start at z = 24 and
end at z = 0. We use the results of these simulations to generate dist
ributions of galaxies at the present (z = 0), as follows: Using a Mont
e Carlo method based on the present distribution of dark matter, we lo
cated similar to 40,000 galaxies in the computational volume. We then
ascribe to each galaxy a morphological type based on the local number
density of galaxies in order to reproduce the observed morphology-dens
ity relation. The resulting galaxy distributions are similar to the ob
served ones, with most ellipticals concentrated in the densest regions
, and most spirals concentrated in low-density regions. By ''tying'' e
ach galaxy to its nearest dark matter particle, we can trace the traje
ctory of that galaxy back in time by simply looking at the location of
that dark matter particle at earlier time slices provided by the N-bo
dy code. This enables us to reconstruct the distribution of galaxies a
t high redshift and the trajectory of each galaxy from its formation e
poch to the present. We use these galaxy distributions to investigate
the problem of morphological evolution. Our goal is to determine wheth
er the morphological type of galaxies is determined primarily by the i
nitial conditions in which these galaxies form or by evolutionary proc
esses (such as mergers or tidal stripping) occurring after the galaxie
s have formed and eventually altering their morphology, or a combinati
on of both effects. Our main technique consists of comparing the envir
onments in which galaxies are at the epoch of galaxy formation (taken
to be at redshift z = 3) with the environment in which the same galaxi
es are at the present. Making the null hypothesis that the morphologic
al types of galaxies do not evolve, we compare the galaxies that form
in low-density environments but end up later in high-density environme
nts to the ones that also form in low-density environments but remain
in low-density environments. The first group contains a larger proport
ion of elliptical and S0 galaxies than the second group. We assume tha
t the initial galaxy formation process cannot distinguish a low-densit
y environment that will always remain low density from one that will e
ventually become high density. Therefore, these results are absurd and
force us to discard the null hypothesis that morphological evolution
does not occur. Our study suggests that similar to 75% of the elliptic
al and S0 galaxies observed at present formed as such, while the remai
ning similar to 25% of these galaxies formed as spiral galaxies and un
derwent morphological evolution for all three cosmological models cons
idered (the percentages might be smaller for elliptical than for S0 ga
laxies). These numbers assume a morphological evolution process that c
onverts one spiral galaxy into either a S0 or an elliptical galaxy. If
the morphological evolution process involves mergers of spiral galaxi
es, these numbers be would closer to 85% and 15%, respectively. We con
clude that most galaxies did not undergo morphological evolution, but
a nonnegligible fraction did.