Skip to content

Commit

Permalink
Merge branch 'master' into bug_in_ncr_modulo_p_patch
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja committed Aug 31, 2024
2 parents 756c9cf + 8bde3ea commit dc6360d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
clean: false
- name: Move & Commit files
run: |
git config --global user.name github-actions
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
rm -rf d* && rm *.html && rm *.svg && rm *.map && rm *.md5 && rm *.png && rm *.js && rm *.css
git add .
Expand Down
27 changes: 25 additions & 2 deletions search/sublist_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ Node *makeLinkedList(const std::vector<uint64_t> &data) {
return head;
}

/*
* @brief This function dealocates memory related to the given list
* It recursively deletes all of the nodes of the input list.
* @param room the root/head of the input list
* @warning Plese note that the memory for each node has to be alocated using
* new.
*/
void deleteList(Node *const root) {
if (root != NULL) {
deleteList(root->next);
delete root;
}
}

/**
* @brief Main searching function
* @param sublist A linked list which is supposed to be searched in mainList.
Expand Down Expand Up @@ -217,8 +231,8 @@ class TestCases {
log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~");

delete (sublistLL);
delete (mainlistLL);
deleteList(mainlistLL);
deleteList(sublistLL);
}

/**
Expand Down Expand Up @@ -270,6 +284,9 @@ class TestCases {
log("[PASS] : TEST CASE 2 PASS!");
log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~");

deleteList(mainlistLL);
deleteList(sublistLL);
}

/**
Expand Down Expand Up @@ -318,6 +335,9 @@ class TestCases {
log("[PASS] : TEST CASE 3 PASS!");
log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~");

deleteList(mainlistLL);
deleteList(sublistLL);
}
};

Expand Down Expand Up @@ -366,5 +386,8 @@ int main(int argc, char *argv[]) {
} else {
std::cout << "[FALSE] - sublist NOT found in main list\n";
}

deleteList(mainlistLL);
deleteList(sublistLL);
return 0;
}

0 comments on commit dc6360d

Please sign in to comment.