C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

chore: Update AVL Tree

Open ritk20 opened this issue 1 year ago • 5 comments

Description of Change

Updated AVL Tree data structure using modern C++ STL library features like std::unique_ptr and implemented Object Oriented structure. Also added additional tests and updated existing tests to use assert.

Checklist

  • [x] Added description of change
  • [x] Added file name matches File name guidelines
  • [x] Added tests and example, test must pass
  • [x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • [x] Relevant documentation/comments is changed or added
  • [x] PR title follows semantic commit guidelines
  • [x] Search previous suggestions before making a new one, as yours may be a duplicate.
  • [x] I acknowledge that all my contributions will be made under the project's license.

Notes: Completed the following TODO

/**
 * \todo update code to use C++ STL library features and OO structure
 * \warning This program is a poor implementation and does not utilize any of
 * the C++ STL features.
 * /

ritk20 avatar Oct 08 '24 12:10 ritk20

this pr should be put on hold until #2746 merges

realstealthninja avatar Oct 08 '24 12:10 realstealthninja

Is it necessary to add class names and variables in snake_case as well?

ritk20 avatar Oct 08 '24 14:10 ritk20

Is it necessary to add class names and variables in snake_case as well?

No, the contributing.md file prefers pascal or camel case last i checked please do check and confirm

realstealthninja avatar Oct 09 '24 00:10 realstealthninja

Is it necessary to add class names and variables in snake_case as well?

No, the contributing.md file prefers pascal or camel case last i checked please do check and confirm

For classes, variables, and functions, there is no explicit mention of a case preference, although the description below led me to believe that snake_case is preferred.

/**
 * @brief Class documentation
 */
class class_name {
 private:
    int variable;   ///< short info of this variable
    char *message;  ///< short info

 public:
    // other members should be also documented as below
}

Also, this makes me believe that snake_case is preferred for functions

template <typename T>
bool is_number_on_array(const std::vector<T> &arr, const int &number) {
    for (int i = 0; i < sizeof(arr) / sizeof(int); i++) {
        if (arr[i] == number) {
            return true;
        }
        else {
            // Number not in the current index, keep searching.
        }
    }

    return false;
}

ritk20 avatar Oct 09 '24 03:10 ritk20

feel free to use snake case instead https://github.com/TheAlgorithms/C-Plus-Plus/discussions/2488 is a discussion worth checking out if you'd like to further make your point

realstealthninja avatar Oct 09 '24 12:10 realstealthninja

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 09 '24 00:11 github-actions[bot]

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

github-actions[bot] avatar Dec 10 '24 00:12 github-actions[bot]