Not only Hg2+, but many cataions with d10 configuration form various complexes, such as divalent zinc, cadmium and Cu+. Although these metals or other examples have d10 configuration and the d orbitals are fully occupied, but they have s and p orbitals which are empty and can accept electrons from suitable ligands. So, it is not surprising that Hg2+ form a wide range of complexes.
Hg2+ will have 18 valence electrons only in 4- coordinate complexes. This metal, however, can form linear two coordinate or octahedral 6-coordinate complexes which don't obey the 18- electron rule.
Yes but understanding the rule first is helpful for understanding the exceptions. If you try to understand why Pd2+ only binds 4 ligands it might be confusing if you dont know the basics.
Thank you all for your helpful answer. But I want to clear one doubt from Prof. Mohammad Kooti that you told me that s and p orbital are vacant, but 5s & 5p are already full filled.