One of my CS professors claimed he had a script to analyze all of his students' programming assignments to find possible instances of cheating. I have no idea how extensive his algorithm was: it could have been anything from a simple whitespace and variable name normalization to an analysis of the abstract syntax tree. Or he may have just been bluffing.