TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Gale Shapley Algorithm More...
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | greedy_algorithms |
for string class | |
namespace | greedy_algorithms::stable_matching |
Functions for the Gale-Shapley Algorithm. | |
Functions | |
std::vector< std::uint32_t > | greedy_algorithms::stable_matching::gale_shapley (const std::vector< std::vector< std::uint32_t > > &secondary_preferences, const std::vector< std::vector< std::uint32_t > > &primary_preferences) |
The main function that finds the stable matching between two sets of elements using the Gale-Shapley Algorithm. | |
static void | tests () |
Self-test implementations. | |
int | main () |
Main function. | |
This implementation utilizes the Gale-Shapley algorithm to find stable matches.
Gale Shapley Algorithm aims to find a stable matching between two equally sized sets of elements given an ordinal preference for each element. The algorithm was introduced by David Gale and Lloyd Shapley in 1962.
Reference: Wikipedia Wikipedia
Definition in file gale_shapley.cpp.
int main | ( | void | ) |
Main function.
Definition at line 152 of file gale_shapley.cpp.
|
static |
Self-test implementations.
Definition at line 114 of file gale_shapley.cpp.