From f4fe0c6f5bbbe5014573a0e27b1526cd07c944f3 Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Thu, 27 Aug 2020 17:13:27 -0400 Subject: [PATCH] [fix] rename data_structures namespace (#1061) * rename data_structures namespace * spelling correction * fix namespace doc name --- data_structures/skip_list.cpp | 14 +++++++------- data_structures/trie_tree.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data_structures/skip_list.cpp b/data_structures/skip_list.cpp index cc679a31c..793994161 100644 --- a/data_structures/skip_list.cpp +++ b/data_structures/skip_list.cpp @@ -20,10 +20,10 @@ #include #include -/** \namespace data_structure +/** \namespace data_structures * \brief Data-structure algorithms */ -namespace data_structure { +namespace data_structures { constexpr int MAX_LEVEL = 2; ///< Maximum level of skip list constexpr float PROBABILITY = 0.5; ///< Current probability for "coin toss" @@ -198,7 +198,7 @@ class SkipList { } }; -} // namespace data_structure +} // namespace data_structures /** * Main function: @@ -208,14 +208,14 @@ class SkipList { int main() { std::srand(std::time(nullptr)); - data_structure::SkipList lst; + data_structures::SkipList lst; - for (int j = 0; j < (1 << (data_structure::MAX_LEVEL + 1)); j++) { - int k = (std::rand() % (1 << (data_structure::MAX_LEVEL + 2)) + 1); + for (int j = 0; j < (1 << (data_structures::MAX_LEVEL + 1)); j++) { + int k = (std::rand() % (1 << (data_structures::MAX_LEVEL + 2)) + 1); lst.insertElement(k, &j); } lst.displayList(); - + return 0; } diff --git a/data_structures/trie_tree.cpp b/data_structures/trie_tree.cpp index c95438cab..e966b2dfd 100644 --- a/data_structures/trie_tree.cpp +++ b/data_structures/trie_tree.cpp @@ -14,10 +14,10 @@ #include #include -/** \namespace data_structure +/** \namespace data_structures * \brief Data-structure algorithms */ -namespace data_structure { +namespace data_structures { /** * @brief [Trie](https://en.wikipedia.org/wiki/Trie) implementation for * small-case English alphabets `a-z` @@ -50,7 +50,7 @@ class trie { /** search a string exists inside a given root trie * @param str string to search for * @param index start index to search from - * @returns `tre` if found + * @returns `true` if found * @returns `false` if not found */ bool search(const std::shared_ptr& root, const std::string& str, @@ -169,14 +169,14 @@ class trie { return false; } }; -} // namespace data_structure +} // namespace data_structures /** * @brief Testing function * @returns void */ static void test() { - data_structure::trie root; + data_structures::trie root; root.insert("Hello"); root.insert("World");