Lecture 10 CSE 331 Sep 22, 2009
Acceptable formats for blog posts Plain text LaTeX HTML
Gale-Shapley Algorithm Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free (m,w) get engaged Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output At most n 2 iterations O(1) time implementation
Gale-Shapley Algorithm Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free (m,w) get engaged Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output Linked list of free women Array Next[w] Array Current[m] Up Next ManPref[m,j] WomanPref[w,j] ManPref[m,j] WomanPref[w,j]
Does m prefer w’ to w? Option 1: m searches through ManPref[m] O(n) time! Define array Ranking[m,w] Initialization? O(n 2 ) time Update?
Reading Assignments Section 2.4 in [KT] Section 2.5 in [KT] Ask Jeff/me if you have questions
Questions?
Graphs Representation of relationships between pairs of entities/elements Entities: News hosts Relationship: Mention in other’s program Entities: News hosts Relationship: Mention in other’s program Vertex Edge
Graphs are omnipresent Airline Route maps
What does this graph represent? Internet
And this one? Math articles on Wikipedia
And this one?
Today’s agenda Basic Graph definitions