Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitffb36c40829557e6c1cd3a18eae15c209c1d95c9 (patch)
Author
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-11-10 07:11:16 +0200
Committer
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-11-10 07:11:16 +0200
Files821e0b96452be1d1dbce34dec9c7eb7c9e4e4eae
Data-structures-and-algorithms-ffb36c40829557e6c1cd3a18eae15c209c1d95c9.tar
Data-structures-and-algorithms-ffb36c40829557e6c1cd3a18eae15c209c1d95c9.tar.gz
Data-structures-and-algorithms-ffb36c40829557e6c1cd3a18eae15c209c1d95c9.zip
Parentdd0ef6e29b24c7cd93ae894627e260c8bf61dc46 (diff)
Parentac43d43d4b9a67b47b02648fc1bb0153191673e9 (diff)
Merge branch 'main' of github.com:stoychoX/Data-structures-and-algorithms
1 files changed, 6 insertions, 6 deletions
-rw-r--r--Seminar06/Linked-List-Palindrome.cpp (renamed from Seminar06/Linked-List-Perm.cpp)12
diff --git a/Seminar06/Linked-List-Perm.cpp b/Seminar06/Linked-List-Palindrome.cpp
index ee2b1e4..8a627a9 100644
--- a/Seminar06/Linked-List-Perm.cpp
+++ b/Seminar06/Linked-List-Palindrome.cpp
@@ -1,28 +1,28 @@
#include"../Seminar04/linked-list-utils.h"
-bool isLinkedListPermRec(const LinkedListNode<int>*& begin, const LinkedListNode<int>* end) {
+bool isLinkedListPalRec(const LinkedListNode<int>*& begin, const LinkedListNode<int>* end) {
if(end == nullptr)
return true;
- bool res = isLinkedListPermRec(begin, end->next) && (begin->data == end->data);
+ bool res = isLinkedListPalRec(begin, end->next) && (begin->data == end->data);
begin = begin->next;
return res;
}
template<class T>
-bool isLinkedListPerm(const LinkedListNode<T>* ll) {
+bool isLinkedListPal(const LinkedListNode<T>* ll) {
if(ll == nullptr)
return true;
const LinkedListNode<int>* begin = ll;
const LinkedListNode<int>* end = ll;
- return isLinkedListPermRec(begin, end);
+ return isLinkedListPalRec(begin, end);
}
int main() {
LinkedListNode<int>* ll = new LinkedListNode(0, new LinkedListNode(1, new LinkedListNode(1)));
- std::cout << isLinkedListPerm(ll);
-} \ No newline at end of file
+ std::cout << isLinkedListPal(ll);
+}