A Link between Coding Theory and Cross-Validation with Applications