|
|
@@ -3,25 +3,10 @@
|
|
|
#include <utility>
|
|
|
#include <queue>
|
|
|
|
|
|
-template<typename SIZE>
|
|
|
-class LevenshteinCoordinates
|
|
|
-{
|
|
|
- public:
|
|
|
- bool operator<(const LevenshteinCoordinates<SIZE> &other) const
|
|
|
- {
|
|
|
- return width < other.width;
|
|
|
- }
|
|
|
-
|
|
|
- private:
|
|
|
- std::pair<SIZE, SIZE> coords;
|
|
|
- unsigned int width;
|
|
|
-};
|
|
|
-
|
|
|
template <class T, typename SIZE=unsigned int>
|
|
|
int levenshtein(const T &a, const T &b, const SIZE aSize, const SIZE bSize)
|
|
|
{
|
|
|
int **items = new int*[aSize +1]();
|
|
|
- std::priority_queue<LevenshteinCoordinates<SIZE> > toProcess;
|
|
|
|
|
|
for (SIZE i =0; i <= aSize; i++)
|
|
|
{
|