But isn't this exactly the Gale Shapely algorithm for stable matching? I was reading the Algorithm Design book by Kleinberg and Tardos and they introduce both the algorithm and also the fact that it's used for matching students with residencies. If it's algorithm enough for a book on algorithms I can't imagine it not matching the way it's used here.