From 763b3710e26fc1e58669927ba59efa5ea2ebc89e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 15 Apr 2022 10:35:28 +0300 Subject: Mainly reworked finding to use binary search and also did some smaller tweaks --- .../Solutions Sem. 08/ex3/WordCollection.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h') 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); -- cgit v1.3.1-26-gb76a