bijective morphism of affine schemes The following question occurred to me while doing exercises in Hartshorne. If $A \to B$ is a homomorphism of (commutative, unital) rings and $f : \text{Spec } B \to \text{Spec } A$ is the corresponding morphism on spectra, does $f$ bijective imply that $f$ is a homeomorphism? If not, can anyone provide a counterexample? The reason this seems reasonable to me is because I think that the inverse set map should preserve inclusions of prime ideals, which is the meaning of continuity in the Zariski topology, but I can't make this rigorous.

No. Let $A$ be a DVR. Let $k$ be the residue field, $K$ the quotient field. There is a map $\mathrm{Spec} k \sqcup \mathrm{Spec} K \to \mathrm{Spec} A$ which is bijective, but not a homeomorphism (one side is discrete and the other is not). Note that $\mathrm{Spec} k \sqcup \mathrm{Spec}K = \mathrm{Spec} k \times K$, so this is an affine scheme.
As Matt E observes below in the comments, one can construct more geometric examples of this phenomenon (e.g. the coproduct of a punctured line plus a point mapping to a line): the point is that things can go very wrong with the topology. 
