diff --git a/a.c b/a.c index a0735be..8ee229c 100644 --- a/a.c +++ b/a.c @@ -17,6 +17,22 @@ string ToUpper(string s) { return s2; } +// -------------------------------------------------------------------------------- +//-Point +struct Point { + Point() {} + Point(int r, int c) : row(r), col(c) {} + + friend ostream& operator<<(ostream& os, const Point& p); // overloading the "<<" op + int row = 0; // defaults value for the constructor + int col = 0; +}; + +ostream& operator<<(ostream& os, const Point& p) { // for printing + os << "(" << p.row << "," << p.col << ")"; + return os; +} + // -------------------------------------------------------------------------------- //-Word struct Word { @@ -78,6 +94,7 @@ public: } void CreatePatternHash(Word* w) { int len = w->len(); + if (len > 7) return; // avoid load of long words int num_patterns = 1 << len; // create 2^len patterns // cout << "PATTERN HASH on " << w->word << "\n"; for (int i=0; i