diff options
Mainly reworked finding to use binary search and also did some smaller tweaks
1 files changed, 6 insertions, 4 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h | 10 |
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h index 18e1b1c..6731d85 100644 --- a/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h +++ b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h @@ -13,9 +13,11 @@ class WordCollection { void copyFrom(const WordCollection& other); void resize(); - void insertSortMapIndex(int position, int value); - void removeSortMapIndex(int position); - int findSortMapIndexWhen(int condition, const char* str); + void insertSortedPos(int index, int value); + void removeSortedPos(int index); + + int findSortedPosIndexFirstBigger(const char* str) const; + int findSortedPosIndex(const char* str) const; public: WordCollection(); @@ -32,7 +34,7 @@ public: friend std::ostream& operator<<(std::ostream& ostrm, const WordCollection& collection); friend std::istream& operator>>(std::istream& istrm, WordCollection& collection); - bool operator[](const char* str); + bool operator[](const char* str) const; }; const WordCollection operator+(const WordCollection& lhs, const WordCollection& rhs); |
