seems odd to write such a mathy question on stackexchange when the literature and popular introductions on how this is done are copious. Further, while there is a lot that algorithms can help with, often times just knowing a bit of domain structural knowledge can be invaluable (for example, using rflps for determining relatedness rather than comparing whole genomes). See also
https://en.wikipedia.org/wiki/Imputation_(genetics)