From ebae8c80545c0e0d0edc8d13f396b3d9660ae2ee Mon Sep 17 00:00:00 2001 From: f p <239882173+f-p-0@users.noreply.github.com> Date: Fri, 29 May 2026 23:17:16 +0000 Subject: [PATCH 1/3] fix: resolve -Wsign-compare in trie_tree.cpp --- data_structures/trie_tree.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data_structures/trie_tree.cpp b/data_structures/trie_tree.cpp index b7b4ce5fd5e..feb2c038bd7 100644 --- a/data_structures/trie_tree.cpp +++ b/data_structures/trie_tree.cpp @@ -54,7 +54,7 @@ class trie { * @returns `false` if not found */ bool search(const std::shared_ptr& root, const std::string& str, - int index) { + size_t index) { if (index == str.length()) { if (!root->isEndofWord) { return false; @@ -104,7 +104,7 @@ class trie { * @returns `true` if found * @returns `false` if not found */ - bool search(const std::string& str, int index) { + bool search(const std::string& str, size_t index) { if (index == str.length()) { if (!isEndofWord) { return false; @@ -131,7 +131,7 @@ class trie { * @returns `true` if successful * @returns `false` if unsuccessful */ - bool deleteString(const std::string& str, int index) { + bool deleteString(const std::string& str, size_t index) { if (index == str.length()) { if (!isEndofWord) { return false; From 616711a9946fafd571e420a3094d0ea9fa0c4c6b Mon Sep 17 00:00:00 2001 From: f p <239882173+f-p-0@users.noreply.github.com> Date: Fri, 29 May 2026 23:20:19 +0000 Subject: [PATCH 2/3] fix: resolve -Wsign-compare in list_array.cpp --- data_structures/list_array.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data_structures/list_array.cpp b/data_structures/list_array.cpp index 0c8099f5788..d53af391ec8 100644 --- a/data_structures/list_array.cpp +++ b/data_structures/list_array.cpp @@ -46,7 +46,7 @@ struct list { * @param val element that will be searched * @return index of element in the list if present else -1 */ - uint64_t BinarySearch(const std::array &dataArr, + int64_t BinarySearch(const std::array &dataArr, const uint64_t &first, const uint64_t &last, const uint64_t &val) { // If both pointer cross each other means no element present in the list @@ -77,7 +77,7 @@ struct list { * @param val element that will be searched * @return index of element in the list if present else -1 */ - uint64_t LinearSearch(const std::array &dataArr, + int64_t LinearSearch(const std::array &dataArr, const uint64_t &val) const { // Going through each element in the list for (uint64_t i = 0; i < top; i++) { @@ -94,8 +94,8 @@ struct list { * @param val element that will be searched * @return index of element in the list if present else -1 */ - uint64_t search(const uint64_t &val) { - uint64_t pos; // pos variable to store index value of element. + int64_t search(const uint64_t &val) { + int64_t pos; // pos variable to store index value of element. // if list is sorted, binary search works efficiently else linear search // is the only option if (isSorted) { @@ -181,7 +181,7 @@ struct list { * @returns void */ void remove(const uint64_t &val) { - uint64_t pos = search(val); // search the index of the value + int64_t pos = search(val); // search the index of the value // if search returns -1, element does not present in the list if (pos == -1) { std::cout << "\n Element does not present in the list "; From 4b0c69d4b54c73c015e0e921f287e9b9e8989863 Mon Sep 17 00:00:00 2001 From: f p <239882173+f-p-0@users.noreply.github.com> Date: Fri, 29 May 2026 23:36:30 +0000 Subject: [PATCH 3/3] fix: resolve -Wsign-compare in queue_using_array.cpp --- data_structures/queue_using_array.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data_structures/queue_using_array.cpp b/data_structures/queue_using_array.cpp index c2437258328..80d8b048b35 100644 --- a/data_structures/queue_using_array.cpp +++ b/data_structures/queue_using_array.cpp @@ -57,13 +57,13 @@ class Queue_Array { * @param ele to be added to the end of the queue */ void Queue_Array::enqueue(const int16_t& ele) { - if (rear == arr.size() - 1) { + if (rear == static_cast(arr.size()) - 1) { std::cout << "\nStack is full"; } else if (front == -1 && rear == -1) { front = 0; rear = 0; arr[rear] = ele; - } else if (rear < arr.size()) { + } else if (rear < static_cast(arr.size())) { ++rear; arr[rear] = ele; }