Download presentation
Presentation is loading. Please wait.
1
Lecture 10 CSE 331 Sep 22, 2009
2
Acceptable formats for blog posts Plain text LaTeX HTML
3
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
4
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]
5
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?
6
Reading Assignments Section 2.4 in [KT] Section 2.5 in [KT] Ask Jeff/me if you have questions
7
Questions?
8
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
9
Graphs are omnipresent Airline Route maps
10
What does this graph represent? Internet
11
And this one? Math articles on Wikipedia
12
And this one?
13
Today’s agenda Basic Graph definitions
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.