Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 08 / ex3 / WordCollection.h
diff options
context:
space:
mode:
Commit763b3710e26fc1e58669927ba59efa5ea2ebc89e (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-15 10:35:28 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-15 10:35:28 +0300
Files7407671c29eb5c92574cd05958a7524dec6e8b2e /Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.tar
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.tar.gz
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.zip
Parentb746daa654ec316331e56a3b243a2dbfb8e59cdb (diff)
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.h10
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);