SQLTeam.com | Weblogs | Forums

Implementing Gale Shapley algorithm in Database using SQL



I am trying to create database in which I want to connect two large sets of users with one another. I intend to implement the Gale Shapley algorithm but need assistance from some SQL gurus to show me how this can be done.

If you can provide me with a solution for this, I'd be very grateful.

Explanation of the Gale Shapley algorithm (and how it applies to the stable marriage problem):


This sounds like homework. Please give it a go and show how far you get with your table design and queries. When you get stuck, we'll jump in with pointers.



Thanks for the response. This isn't homework. I'm actually a full time contractor who's been in the database industry for about 10 years and this is a side project I'm working on for myself. It's just an idea right now, as I haven't created the actual database yet. I have seen many cases online of the gale-shapley algorithm being used in C++, PERL, Java, etc. but I hadn't seen it being used in a database yet with SQL yet, hence my curiosity as to whether it was a plausible and efficient concept.

I will try to post something when I have my databases created, I was just checking this forum to see if you guys had any experience working with the algorithm in SQL before and what that might look like.