Gravitational interactions — mergers and y-by encounters — between galaxies play a key role as the drivers of their evolution. Here we perform a cosmological N-body simulation using the tree-particle-mesh code GOTPM, and attempt to separate out the effects of mergers and y-bys between dark matter halos. Once close pair halos are identified by the halo finding algorithm PSB, they are classified into mergers (E12 < 0) and y-by encounters (E12 > 0) based on the total energy (E12) between two halos. The y-by and merger fractions as functions of redshift, halo masses, and ambient environments are calculated and the result shows the following: (1) Among Milky-way sized halos (0:33-2:0 X 1012h-1M⊙), 5:37±0:03% have experienced major y-bys and 7.98±0.04% have undergone major mergers since z ~ 1; (2) Among dwarf halos (0:1 - 0.33 X 1012h-1M⊙), 6.42 ± 0.02% went through major y-bys and 9.51 ± 0.03% experienced major mergers since z ~ 1; (3) Milky-way sized halos in the cluster environment experienced fly-bys (mergers) 4-11(1.5 - 1.7) times more frequently than those in the field since z ~ 1; and (4) Approaching z = 0, the y-by fraction decreases sharply with the merger fraction remaining constant, implying that the empirical pair/merger fractions (that decrease from z ~ 1) are in fact driven by the fly-bys, not by the mergers themselves.