The process of joining two complementary strands of DNA or one each of DNA and RNA to form a double-stranded molecule..