diff --git a/.github/workflows/awesome_forkflow.yml b/.github/workflows/awesome_forkflow.yml new file mode 100644 index 000000000..05094bdd1 --- /dev/null +++ b/.github/workflows/awesome_forkflow.yml @@ -0,0 +1,211 @@ +name: Awesome CI Workflow + +on: [push] +# push: +# branches: [ master ] +# pull_request: +# branches: [ master ] + +jobs: + code_format: + name: Code Formatter + runs-on: ubuntu-latest + steps: + - name: requirements + run: | + sudo apt -qq -y update + sudo apt -qq install clang-format + - uses: actions/checkout@master + with: + submodules: true + - name: Setup Git Specs + run: | + git config --global user.name github-actions + 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 + - name: Filename Formatter + run: | + IFS=$'\n' + for fname in `find . -type f -name '*.cpp' -o -name '*.cc' -o -name '*.h'` + do + echo "${fname}" + new_fname=`echo ${fname} | tr ' ' '_'` + echo " ${new_fname}" + new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'` + echo " ${new_fname}" + new_fname=`echo ${new_fname} | tr '-' '_'` + echo " ${new_fname}" + new_fname=${new_fname/.cc/.cpp} + echo " ${new_fname}" + if [ ${fname} != ${new_fname} ] + then + echo " ${fname} --> ${new_fname}" + git "mv" "${fname}" ${new_fname} + fi + done + git commit -am "formatting filenames $GITHUB_SHA" || true + - name: Clang Formatter + run: | + for fname in $(find . -name '*.cpp' -o -name '*.h') + do + clang-format --verbose -i --style="$line1 $line2 $line3 $line4" "$fname" + done + git commit -am "formatting source-code for $GITHUB_SHA" || true + env: + line1: "{ BasedOnStyle: Google, UseTab: Never," + line2: "IndentWidth: 4, TabWidth: 4, " + line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false," + line4: "ColumnLimit: 80, AccessModifierOffset: -3 }" + - name: Git Push + run: git push --force origin HEAD:$GITHUB_REF || true + + update_directory_md: + name: Update Directory.md + needs: code_format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + - name: pull latest commit + run: git pull + - name: Update DIRECTORY.md + shell: python + run: | + import os + from typing import Iterator + + URL_BASE = "https://github.com/TheAlgorithms/C-Plus-Plus/blob/master" + g_output = [] + + def good_filepaths(top_dir: str = ".") -> Iterator[str]: + cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split()) + for dirpath, dirnames, filenames in os.walk(top_dir): + dirnames[:] = [d for d in dirnames if d[0] not in "._"] + for filename in filenames: + if os.path.splitext(filename)[1].lower() in cpp_exts: + yield os.path.join(dirpath, filename).lstrip("./") + + def md_prefix(i): + return f"{i * ' '}*" if i else "\n##" + + def print_path(old_path: str, new_path: str) -> str: + global g_output + old_parts = old_path.split(os.sep) + for i, new_part in enumerate(new_path.split(os.sep)): + if i + 1 > len(old_parts) or old_parts[i] != new_part: + if new_part: + g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}") + return new_path + + def build_directory_md(top_dir: str = ".") -> str: + global g_output + old_path = "" + for filepath in sorted(good_filepaths(), key=str.lower): + filepath, filename = os.path.split(filepath) + if filepath != old_path: + old_path = print_path(old_path, filepath) + indent = (filepath.count(os.sep) + 1) if filepath else 0 + url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20") + filename = os.path.splitext(filename.replace("_", " ").title())[0] + g_output.append(f"{md_prefix(indent)} [{filename}]({url})") + return "# List of all files\n" + "\n".join(g_output) + + with open("DIRECTORY.md", "w") as out_file: + out_file.write(build_directory_md(".") + "\n") + - name: Update DIRECTORY.md + run: | + cat DIRECTORY.md + git config --global user.name github-actions + 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 + git add DIRECTORY.md + git commit -am "updating DIRECTORY.md" || true + git push --force origin HEAD:$GITHUB_REF || true + + # cpplint: + # name: CPPLINT + # needs: code_format + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@master + # - uses: actions/setup-python@master + # - run: pip install cpplint + # - run: git pull + # - run: cpplint --filter=-legal --recursive . + + cpplint_modified_files: + runs-on: ubuntu-latest + needs: code_format + name: CPPLINT + steps: + - uses: actions/checkout@master # v2 is broken for git diff + - uses: actions/setup-python@master + - run: python -m pip install cpplint + - run: git remote -v + - run: git branch + - run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY + - run: git pull + - run: git diff --diff-filter=dr --name-only origin/master > git_diff.txt + - run: echo "Files changed-- `cat git_diff.txt`" + - name: cpplint_modified_files + shell: python + run: | + import os + import subprocess + import sys + + print("Python {}.{}.{}".format(*sys.version_info)) # Python 3.8 + with open("git_diff.txt") as in_file: + modified_files = sorted(in_file.read().splitlines()) + print("{} files were modified.".format(len(modified_files))) + + cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split()) + cpp_files = [file for file in modified_files if file.lower().endswith(cpp_exts)] + print(f"{len(cpp_files)} C++ files were modified.") + if not cpp_files: + sys.exit(0) + + print("cpplint:") + for cpp_file in cpp_files: + subprocess.run(["cpplint", "--filter=-legal/copyright", cpp_file], check=True, text=True) + + print("g++:") + # compile_exts = tuple(".c .c++ .cc .cpp .cu .cxx".split()) + # compile_files = [file for file in cpp_files if file.lower().endswith(compile_exts)] + for cpp_file in cpp_files: + subprocess.run(["g++", cpp_file], check=True, text=True) + + upper_files = [file for file in cpp_files if file != file.lower()] + if upper_files: + print(f"{len(upper_files)} files contain uppercase characters:") + print("\n".join(upper_files) + "\n") + + space_files = [file for file in cpp_files if " " in file or "-" in file] + if space_files: + print(f"{len(space_files)} files contain space or dash characters:") + print("\n".join(space_files) + "\n") + + nodir_files = [file for file in cpp_files if file.count(os.sep) != 1] + if nodir_files: + print(f"{len(nodir_files)} files are not in one and only one directory:") + print("\n".join(nodir_files) + "\n") + + bad_files = len(upper_files + space_files + nodir_files) + if bad_files: + sys.exit(bad_files) + + build: + name: Compile checks + runs-on: ${{ matrix.os }} + # needs: [cpplint, update_directory_md, cpplint_modified_files] + needs: [update_directory_md] + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@master + with: + submodules: true + - run: git pull + - run: cmake -B ./build -S . + - run: cmake --build build diff --git a/.github/workflows/cpplint.yml b/.github/workflows/cpplint.yml deleted file mode 100644 index a6999e1f2..000000000 --- a/.github/workflows/cpplint.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: cpplint -on: [push, pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - - run: pip install cpplint - # - run: cpplint --filter= # print out all cpplint rules - - run: cpplint --recursive . || true # all issues to be fixed - # TODO: Remove each filter one at a time and fix those failures - - run: cpplint --filter=-build,-legal,-readability,-runtime,-whitespace --recursive . diff --git a/.github/workflows/cpplint_modified_files.yml b/.github/workflows/cpplint_modified_files.yml deleted file mode 100644 index 07a32ece9..000000000 --- a/.github/workflows/cpplint_modified_files.yml +++ /dev/null @@ -1,64 +0,0 @@ -# GitHub Action that enables a repo to achieve gradual compliance with cpplint by -# linting only those files that have been added or modified (vs. origin/master). -# 1. runs cpplint only on those files that have been modified vs. origin/master. -# 2. compiles with g++ only those files that have been modified vs. origin/master. -# 3. other optional filepath verifications may be commented out at the end of this file. -# From: https://github.com/cpplint/GitHub-Action-for-cpplint - -name: cpplint_modified_files -on: [push, pull_request] -jobs: - cpplint_modified_files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 # v2 is broken for git diff - - uses: actions/setup-python@v1 - - run: python -m pip install cpplint - - run: git remote -v - - run: git branch - - run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - - run: git diff --diff-filter=dr --name-only origin/master > git_diff.txt - - name: cpplint_modified_files - shell: python - run: | - import os - import subprocess - import sys - - print("Python {}.{}.{}".format(*sys.version_info)) # Python 3.8 - with open("git_diff.txt") as in_file: - modified_files = sorted(in_file.read().splitlines()) - print("{} files were modified.".format(len(modified_files))) - - cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split()) - cpp_files = [file for file in modified_files if file.lower().endswith(cpp_exts)] - print(f"{len(cpp_files)} C++ files were modified.") - if not cpp_files: - sys.exit(0) - - print("cpplint:") - subprocess.run(["cpplint", "--filter=-legal/copyright"] + cpp_files, check=True, text=True) - - print("g++:") - # compile_exts = tuple(".c .c++ .cc .cpp .cu .cxx".split()) - # compile_files = [file for file in cpp_files if file.lower().endswith(compile_exts)] - subprocess.run(["g++"] + cpp_files, check=True, text=True) - - upper_files = [file for file in cpp_files if file != file.lower()] - if upper_files: - print(f"{len(upper_files)} files contain uppercase characters:") - print("\n".join(upper_files) + "\n") - - space_files = [file for file in cpp_files if " " in file or "-" in file] - if space_files: - print(f"{len(space_files)} files contain space or dash characters:") - print("\n".join(space_files) + "\n") - - nodir_files = [file for file in cpp_files if file.count(os.sep) != 1] - if nodir_files: - print(f"{len(nodir_files)} files are not in one and only one directory:") - print("\n".join(nodir_files) + "\n") - - bad_files = len(upper_files + space_files + nodir_files) - if bad_files: - sys.exit(bad_files) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 000000000..700d1a3f7 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,34 @@ +name: Doxygen CI + +on: + push: + branches: [master] + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@master + with: + submodules: true + - name: Install requirements + run: | + brew install graphviz ninja doxygen + - name: configure + run: cmake -G Ninja -B ./build -S . + - name: build + run: cmake --build build -t doc + - name: gh-pages + uses: actions/checkout@master + with: + ref: "gh-pages" + clean: false + - name: Move & Commit files + run: | + cp -rp ./build/html/* . && rm -rf ./build && ls -lah + git config --global user.name github-actions + 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 + git add * + git commit -m "Documentation for $GITHUB_SHA" || true + git push --force || true diff --git a/.github/workflows/sorting_non_recursive_merge_sort.yml b/.github/workflows/sorting_non_recursive_merge_sort.yml deleted file mode 100644 index add9efd5d..000000000 --- a/.github/workflows/sorting_non_recursive_merge_sort.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: sorting_non_recursive_merge_sort -on: - pull_request: - push: - # branches: [master] -jobs: - sorting_non_recursive_merge_sort: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: mattnotmitt/doxygen-action@master - with: - working-directory: 'sorting/' - doxyfile-path: 'doxy.txt' - #- uses: peaceiris/actions-gh-pages@v3 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # publish_dir: ./sorting - # external_repository: TheAlgorithms/C-Plus-Plus - # publish_branch: master - # enable_jekyll: true - - run: | - cd sorting - make test diff --git a/.github/workflows/update_directory_md.yml b/.github/workflows/update_directory_md.yml deleted file mode 100644 index 1d63374b0..000000000 --- a/.github/workflows/update_directory_md.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push -name: update_directory_md -on: [push] -jobs: - update_directory_md: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - - name: update_directory_md - shell: python - run: | - import os - from typing import Iterator - - URL_BASE = "https://github.com/TheAlgorithms/C-Plus-Plus/blob/master" - g_output = [] - - - def good_filepaths(top_dir: str = ".") -> Iterator[str]: - cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split()) - for dirpath, dirnames, filenames in os.walk(top_dir): - dirnames[:] = [d for d in dirnames if d[0] not in "._"] - for filename in filenames: - if os.path.splitext(filename)[1].lower() in cpp_exts: - yield os.path.join(dirpath, filename).lstrip("./") - - - def md_prefix(i): - return f"{i * ' '}*" if i else "\n##" - - - def print_path(old_path: str, new_path: str) -> str: - global g_output - old_parts = old_path.split(os.sep) - for i, new_part in enumerate(new_path.split(os.sep)): - if i + 1 > len(old_parts) or old_parts[i] != new_part: - if new_part: - g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}") - return new_path - - - def build_directory_md(top_dir: str = ".") -> str: - global g_output - old_path = "" - for filepath in sorted(good_filepaths(), key=str.lower): - filepath, filename = os.path.split(filepath) - if filepath != old_path: - old_path = print_path(old_path, filepath) - indent = (filepath.count(os.sep) + 1) if filepath else 0 - url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20") - filename = os.path.splitext(filename.replace("_", " ").title())[0] - g_output.append(f"{md_prefix(indent)} [{filename}]({url})") - return "\n".join(g_output) - - - with open("DIRECTORY.md", "w") as out_file: - out_file.write(build_directory_md(".") + "\n") - - - name: Update DIRECTORY.md - run: | - cat DIRECTORY.md - git config --global user.name github-actions - 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 - git add DIRECTORY.md - git commit -am "updating DIRECTORY.md" || true - git push --force origin HEAD:$GITHUB_REF || true diff --git a/.gitignore b/.gitignore index ed3934e45..5275088d0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ a.out *.out *.app + +build/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 0ab2708d0..0a257500b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -64,7 +64,7 @@ "valarray": "cpp", "algorithm": "cpp" }, - "C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 80, UseTab: Never}", + "C_Cpp.clang_format_style": "{ BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 80, AccessModifierOffset: -3, NamespaceIndentation: All }", "editor.formatOnSave": true, "editor.formatOnType": true, "editor.formatOnPaste": true diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..95c09d8e2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.3) +project(Algorithms_in_C++ + LANGUAGES CXX + VERSION 1.0.0 + DESCRIPTION "Set of algorithms implemented in C++." +) + +# set(CMAKE_CXX_CPPLINT "~/anaconda3/bin/cpplint --filter=-legal/copyright --std=c++11") +# find_program(CLANG_FORMAT "clang-format") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if(MSVC) + # set(CMAKE_CXX_STANDARD 14) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) +endif(MSVC) + +option(USE_OPENMP "flag to use OpenMP for multithreading" ON) + +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0057 NEW) +find_package(Doxygen OPTIONAL_COMPONENTS dot dia) +if(DOXYGEN_FOUND) + set(DOXYGEN_GENERATE_MAN NO) + set(DOXYGEN_USE_MATHJAX YES) + set(DOXYGEN_GENERATE_HTML YES) + set(DOXYGEN_EXTRACT_STATIC YES) + set(DOXYGEN_INLINE_SOURCES YES) + set(DOXYGEN_CREATE_SUBDIRS YES) + set(DOXYGEN_EXTRACT_PRIVATE YES) + set(DOCYGEN_GENERATE_TREEVIEW YES) + set(DOXYGEN_STRIP_CODE_COMMENTS NO) + set(DOXYGEN_BUILTIN_STL_SUPPORT YES) + set(DOXYGEN_FILE_PATTERNS *.cpp *.h *.hpp *.md) + set(DOXYGEN_MATHJAX_EXTENSIONS TeX/AMSmath TeX/AMSsymbols) + set(DOXYGEN_TAGFILES "doc/cppreference-doxygen-web.tag.xml=http://en.cppreference.com/w/") + if(MSVC) + set(DOXYGEN_CPP_CLI_SUPPORT YES) + endif() + set(DOXYGEN_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML") + if(Doxygen_dot_FOUND) + set(DOXYGEN_HAVE_DOT YES) + set(DOXYGEN_CALL_GRAPH YES) + set(DOXYGEN_INTERACTIVE_SVG YES) + set(DOXYGEN_DOT_IMAGE_FORMAT "svg") + endif() + + doxygen_add_docs( + doc + ${PROJECT_SOURCE_DIR} + COMMENT "Generate documentation" + ) +endif() + +add_subdirectory(math) +add_subdirectory(others) +add_subdirectory(search) +add_subdirectory(strings) +add_subdirectory(sorting) +add_subdirectory(probability) +add_subdirectory(computer_oriented_statistical_methods) + +if(USE_OPENMP) + find_package(OpenMP) + if (OpenMP_CXX_FOUND) + message(STATUS "Building with OpenMP Multithreading.") + else() + message(STATUS "No OpenMP found, no multithreading.") + endif() +endif() + +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +include(CPack) diff --git a/DIRECTORY.md b/DIRECTORY.md index 780eea03e..21f1a0c61 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -1,3 +1,4 @@ +# List of all files ## Backtracking * [Graph Coloring](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/graph_coloring.cpp) @@ -10,19 +11,18 @@ * [Sudoku Solve](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/sudoku_solve.cpp) ## Computer Oriented Statistical Methods - * [Bisection Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/Bisection_method.CPP) - * [False-Position](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/false-position.cpp) - * [Gaussian Elimination](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/Gaussian_elimination.cpp) - * [Newton Raphson](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/Newton_Raphson.CPP) + * [Bisection Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/bisection_method.cpp) + * [False Position](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/false_position.cpp) + * [Gaussian Elimination](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/gaussian_elimination.cpp) + * [Newton Raphson Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/newton_raphson_method.cpp) * [Ordinary Least Squares Regressor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp) - * [Secant Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/Secant_method.CPP) - * [Successive Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/successive_approximation.CPP) + * [Successive Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/computer_oriented_statistical_methods/successive_approximation.cpp) ## Data Structure - * [Avltree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/AVLtree.cpp) - * [Binary Search Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Binary%20Search%20Tree.cpp) - * [Binaryheap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Binaryheap.cpp) - * [Circular Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/circular_Queue_using_Linked_List.cpp) + * [Avltree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/avltree.cpp) + * [Binary Search Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/binary_search_tree.cpp) + * [Binaryheap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/binaryheap.cpp) + * [Circular Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/circular_queue_using_linked_list.cpp) * Cll * [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/cll/cll.cpp) * [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/cll/cll.h) @@ -30,72 +30,73 @@ * [Disjoint Set](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/disjoint_set.cpp) * [Doubly Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/doubly_linked_list.cpp) * [Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/linked_list.cpp) - * [Linkedlist Implentation Usingarray](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/linkedList_implentation_usingArray.cpp) - * [List Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/List%20Array.cpp) - * [Morrisinorder](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/MorrisInorder.cpp) - * [Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Queue%20Using%20Array.cpp) - * [Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Queue%20Using%20Linked%20List.cpp) + * [Linkedlist Implentation Usingarray](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/linkedlist_implentation_usingarray.cpp) + * [List Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/list_array.cpp) + * [Morrisinorder](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/morrisinorder.cpp) * Queue * [Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue/queue.cpp) * [Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue/queue.h) * [Test Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue/test_queue.cpp) * [Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue_using_array.cpp) + * [Queue Using Array2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue_using_array2.cpp) + * [Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue_using_linked_list.cpp) * [Queue Using Linkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/queue_using_linkedlist.cpp) - * [Stack Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Stack%20Using%20Array.cpp) - * [Stack Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Stack%20Using%20Linked%20List.cpp) + * [Stack Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stack_using_array.cpp) + * [Stack Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stack_using_linked_list.cpp) * Stk * [Main](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stk/main.cpp) * [Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stk/stack.cpp) * [Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stk/stack.h) * [Test Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/stk/test_stack.cpp) - * [Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/Tree.cpp) + * [Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/tree.cpp) * [Trie Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structure/trie_tree.cpp) ## Dynamic Programming - * [0-1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/0-1%20Knapsack.cpp) + * [0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/0_1_knapsack.cpp) * [Armstrong Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/armstrong_number.cpp) - * [Bellman-Ford](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Bellman-Ford.cpp) - * [Catalan-Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Catalan-Numbers.cpp) - * [Coin-Change](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Coin-Change.cpp) - * [Cut Rod](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Cut%20Rod.cpp) - * [Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Edit%20Distance.cpp) - * [Egg-Dropping-Puzzle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Egg-Dropping-Puzzle.cpp) - * [Fibonacci Bottom Up](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Fibonacci_Bottom_Up.cpp) - * [Fibonacci Top Down](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Fibonacci_Top_Down.cpp) - * [Floyd-Warshall](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Floyd-Warshall.cpp) + * [Bellman Ford](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/bellman_ford.cpp) + * [Catalan Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/catalan_numbers.cpp) + * [Coin Change](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/coin_change.cpp) + * [Cut Rod](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/cut_rod.cpp) + * [Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/edit_distance.cpp) + * [Egg Dropping Puzzle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/egg_dropping_puzzle.cpp) + * [Fibonacci Bottom Up](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/fibonacci_bottom_up.cpp) + * [Fibonacci Top Down](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/fibonacci_top_down.cpp) + * [Floyd Warshall](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/floyd_warshall.cpp) * [Kadane](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/kadane.cpp) - * [Longest Common Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Longest%20Common%20Subsequence.cpp) - * [Longest Increasing Subsequence (Nlogn)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Longest%20Increasing%20Subsequence%20(nlogn).cpp) - * [Longest Increasing Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Longest%20Increasing%20Subsequence.cpp) * [Longest Common String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_common_string.cpp) - * [Matrix-Chain-Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/Matrix-Chain-Multiplication.cpp) + * [Longest Common Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_common_subsequence.cpp) + * [Longest Increasing Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_increasing_subsequence.cpp) + * [Longest Increasing Subsequence (Nlogn)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp) + * [Matrix Chain Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/matrix_chain_multiplication.cpp) * [Searching Of Element In Dynamic Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/searching_of_element_in_dynamic_array.cpp) * [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/tree_height.cpp) ## Graph - * [Bfs](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/BFS.cpp) + * [Bfs](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/bfs.cpp) * [Bridge Finding With Tarjan Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/bridge_finding_with_tarjan_algorithm.cpp) * [Connected Components](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/connected_components.cpp) * [Connected Components With Dsu](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/connected_components_with_dsu.cpp) - * [Dfs](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/DFS.cpp) - * [Dfs With Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/DFS_with_stack.cc) - * [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/Dijkstra.cpp) + * [Dfs](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/dfs.cpp) + * [Dfs With Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/dfs_with_stack.cpp) + * [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/dijkstra.cpp) * [Kosaraju](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/kosaraju.cpp) - * [Kruskal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/Kruskal.cpp) + * [Kruskal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/kruskal.cpp) * [Lca](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/lca.cpp) + * [Max Flow With Ford Fulkerson And Edmond Karp Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp) * [Prim](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/prim.cpp) - * [Topological-Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/Topological-Sort.cpp) + * [Topological Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/topological_sort.cpp) * [Topological Sort By Kahns Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/topological_sort_by_kahns_algo.cpp) ## Greedy Algorithms - * [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/Dijkstra.cpp) + * [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/dijkstra.cpp) * [Huffman](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/huffman.cpp) - * [Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/Knapsack.cpp) - * [Kruskals Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/Kruskals%20Minimum%20Spanning%20Tree.cpp) - * [Prims Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/Prims%20Minimum%20Spanning%20Tree.cpp) + * [Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/knapsack.cpp) + * [Kruskals Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/kruskals_minimum_spanning_tree.cpp) + * [Prims Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/prims_minimum_spanning_tree.cpp) ## Hashing - * [Chaining](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/Chaining.cpp) + * [Chaining](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/chaining.cpp) * [Double Hash Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/double_hash_hash_table.cpp) * [Linear Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/linear_probing_hash_table.cpp) * [Quadratic Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/quadratic_probing_hash_table.cpp) @@ -108,52 +109,51 @@ * [Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/factorial.cpp) * [Fast Power](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fast_power.cpp) * [Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci.cpp) - * [Greatest Common Divisor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/greatest_common_divisor.cpp) - * [Greatest Common Divisor Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/greatest_common_divisor_euclidean.cpp) + * [Fibonacci Fast](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_fast.cpp) + * [Fibonacci Large](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_large.cpp) + * [Gcd Iterative Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_iterative_euclidean.cpp) + * [Gcd Of N Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_of_n_numbers.cpp) + * [Gcd Recursive Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_recursive_euclidean.cpp) + * [Large Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/large_factorial.cpp) + * [Large Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/large_number.h) * [Modular Inverse Fermat Little Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/modular_inverse_fermat_little_theorem.cpp) * [Number Of Positive Divisors](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/number_of_positive_divisors.cpp) * [Power For Huge Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/power_for_huge_numbers.cpp) * [Prime Factorization](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/prime_factorization.cpp) * [Prime Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/prime_numbers.cpp) - * [Primes Up To 10^8](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/primes_up_to_10^8.cpp) - * [Realtime Stats](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/realtime_stats.cpp) + * [Primes Up To Billion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/primes_up_to_billion.cpp) * [Sieve Of Eratosthenes](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sieve_of_eratosthenes.cpp) * [Sqrt Double](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sqrt_double.cpp) + * [String Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/string_fibonacci.cpp) ## Operations On Datastructures - * [Array Left Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Array%20Left%20Rotation.cpp) - * [Array Right Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Array%20Right%20Rotation.cpp) - * [Circular Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Circular%20Linked%20List.cpp) - * [Circular Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Circular%20Queue%20Using%20Array.cpp) + * [Array Left Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/array_left_rotation.cpp) + * [Array Right Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/array_right_rotation.cpp) + * [Circular Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/circular_linked_list.cpp) + * [Circular Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/circular_queue_using_array.cpp) * [Get Size Of Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/get_size_of_linked_list.cpp) - * [Intersection Of 2 Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Intersection_of_2_arrays.cpp) - * [Reverse A Linked List Using Recusion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Reverse%20a%20Linked%20List%20using%20Recusion.cpp) - * [Selectionsortlinkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/selectionSortLinkedList.cpp) - * [Union Of 2 Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/Union_of_2_arrays.cpp) + * [Intersection Of 2 Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/intersection_of_2_arrays.cpp) + * [Reverse A Linked List Using Recusion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp) + * [Selectionsortlinkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/selectionsortlinkedlist.cpp) + * [Union Of 2 Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/union_of_2_arrays.cpp) ## Others - * [Buzz Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Buzz_number.cpp) - * [Decimal To Binary](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Decimal%20To%20Binary.cpp) - * [Decimal To Hexadecimal ](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Decimal%20To%20Hexadecimal%20.cpp) - * [Decimal To Roman Numeral](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Decimal%20to%20Roman%20Numeral.cpp) + * [Buzz Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/buzz_number.cpp) + * [Decimal To Binary](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_binary.cpp) + * [Decimal To Hexadecimal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_hexadecimal.cpp) + * [Decimal To Roman Numeral](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_roman_numeral.cpp) * [Fast Interger Input](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/fast_interger_input.cpp) - * [Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/fibonacci.cpp) - * [Gcd Of N Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/GCD_of_n_numbers.cpp) * [Happy Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/happy_number.cpp) * [Matrix Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/matrix_exponentiation.cpp) - * [Measure Time Elapsed](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/measure_time_elapsed.cpp) - * [Palindromeofnumber](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Palindromeofnumber.cpp) - * [Paranthesis Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Paranthesis%20Matching.cpp) + * [Palindrome Of Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/palindrome_of_number.cpp) + * [Paranthesis Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/paranthesis_matching.cpp) * [Pascal Triangle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/pascal_triangle.cpp) - * [Primality Test](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Primality%20Test.cpp) - * [Sieve Of Eratosthenes](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/sieve_of_Eratosthenes.cpp) - * [Smallest-Circle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/smallest-circle.cpp) - * [Sparse Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Sparse%20matrix.cpp) + * [Primality Test](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/primality_test.cpp) + * [Smallest Circle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/smallest_circle.cpp) + * [Sparse Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/sparse_matrix.cpp) * [Spiral Print](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/spiral_print.cpp) * [Stairs Pattern](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/stairs_pattern.cpp) - * [Strassen Matrix Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Strassen%20Matrix%20Multiplication.cpp) - * [String Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/String%20Fibonacci.cpp) - * [Tower Of Hanoi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/Tower%20of%20Hanoi.cpp) + * [Tower Of Hanoi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/tower_of_hanoi.cpp) * [Vector Important Functions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/vector_important_functions.cpp) ## Probability @@ -164,45 +164,46 @@ ## Range Queries * [Bit](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/bit.cpp) - * [Fenwicktree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/FenwickTree.cpp) - * [Mo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/MO.cpp) - * [Segtree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/segTree.cpp) + * [Fenwicktree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/fenwicktree.cpp) + * [Mo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/mo.cpp) + * [Segtree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/segtree.cpp) ## Search * [Binary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/binary_search.cpp) * [Exponential Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/exponential_search.cpp) * [Hash Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/hash_search.cpp) - * [Interpolation Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/Interpolation%20Search.cpp) * [Interpolation Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/interpolation_search.cpp) + * [Interpolation Search2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/interpolation_search2.cpp) * [Jump Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/jump_search.cpp) - * [Linear Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/Linear%20Search.cpp) + * [Linear Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/linear_search.cpp) * [Median Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/median_search.cpp) - * [Searching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/searching.cpp) * [Ternary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/ternary_search.cpp) + * [Text Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/text_search.cpp) ## Sorting - * [Beadsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/BeadSort.cpp) - * [Bitonicsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/BitonicSort.cpp) - * [Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Bubble%20Sort.cpp) - * [Bucketsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bucketSort.cpp) - * [Cocktailselectionsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/CocktailSelectionSort.cpp) - * [Combsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/combsort.cpp) - * [Counting Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Counting_Sort.cpp) - * [Countingsortstring](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/CountingSortString.cpp) + * [Bead Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bead_sort.cpp) + * [Bitonic Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bitonic_sort.cpp) + * [Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bubble_sort.cpp) + * [Bucket Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bucket_sort.cpp) + * [Cocktail Selection Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/cocktail_selection_sort.cpp) + * [Comb Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/comb_sort.cpp) + * [Counting Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/counting_sort.cpp) + * [Counting Sort String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/counting_sort_string.cpp) * [Heap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/heap_sort.cpp) - * [Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Insertion%20Sort.cpp) + * [Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/insertion_sort.cpp) * [Library Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/library_sort.cpp) - * [Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Merge%20Sort.cpp) + * [Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/merge_sort.cpp) * [Non Recursive Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/non_recursive_merge_sort.cpp) - * [Numericstringsort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/NumericStringSort.cpp) - * [Oddeven Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/OddEven%20Sort.cpp) - * [Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Quick%20Sort.cpp) - * [Radix Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Radix%20Sort.cpp) - * [Selection Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Selection%20Sort.cpp) - * [Shell Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Shell%20Sort.cpp) - * [Slow Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Slow%20Sort.cpp) + * [Numeric String Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/numeric_string_sort.cpp) + * [Odd Even Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/odd_even_sort.cpp) + * [Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/quick_sort.cpp) + * [Radix Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/radix_sort.cpp) + * [Selection Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/selection_sort.cpp) + * [Shell Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/shell_sort.cpp) + * [Shell Sort2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/shell_sort2.cpp) + * [Slow Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/slow_sort.cpp) * [Swap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/swap_sort.cpp) - * [Tim Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/Tim%20Sort.cpp) + * [Tim Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/tim_sort.cpp) ## Strings * [Brute Force String Searching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/brute_force_string_searching.cpp) diff --git a/README.md b/README.md index a3077cdc5..df39ee554 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ -# The Algorithms - C++ -[![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTION.md)  -![GitHub repo size](https://img.shields.io/github/repo-size/TheAlgorithms/C-Plus-Plus?color=red&style=flat-square) -![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/TheAlgorithms/C-Plus-Plus?color=green&style=flat-square) +# The Algorithms - C++ # {#mainpage} -### All algorithms implemented in C++ (for education) +[![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)](https://github.com/kvedala/C-Plus-Plus/blob/master/CONTRIBUTION.md)  +![GitHub repo size](https://img.shields.io/github/repo-size/kvedala/C-Plus-Plus?color=red&style=flat-square) +![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/kvedala/C-Plus-Plus?color=green&style=flat-square) +![Doxygen CI](https://github.com/kvedala/C-Plus-Plus/workflows/Doxygen%20CI/badge.svg) +![cpplint](https://github.com/kvedala/C-Plus-Plus/workflows/cpplint_modified_files/badge.svg) +![C/C++ CI](https://github.com/kvedala/C-Plus-Plus/workflows/C/C++%20CI/badge.svg) + +[Online Documentation](https://kvedala.github.io/C-Plus-Plus). + +Click on [Files menu](https://kvedala.github.io/C-Plus-Plus/files.html) to see the list of all the files documented with the code. + +### Algorithms implemented in C++ (for education) The implementations are for learning purpose. They may be less efficient than the implementation in the standard library. ### Contribute Guidelines diff --git a/backtracking/graph_coloring.cpp b/backtracking/graph_coloring.cpp index cadc6d5ec..19a983019 100644 --- a/backtracking/graph_coloring.cpp +++ b/backtracking/graph_coloring.cpp @@ -7,8 +7,7 @@ void printSolution(int color[]); /* A utility function to check if the current color assignment is safe for vertex v */ -bool isSafe(int v, bool graph[V][V], int color[], int c) -{ +bool isSafe(int v, bool graph[V][V], int color[], int c) { for (int i = 0; i < V; i++) if (graph[v][i] && c == color[i]) return false; @@ -16,22 +15,18 @@ bool isSafe(int v, bool graph[V][V], int color[], int c) } /* A recursive utility function to solve m coloring problem */ -void graphColoring(bool graph[V][V], int m, int color[], int v) -{ +void graphColoring(bool graph[V][V], int m, int color[], int v) { /* base case: If all vertices are assigned a color then return true */ - if (v == V) - { + if (v == V) { printSolution(color); return; } /* Consider this vertex v and try different colors */ - for (int c = 1; c <= m; c++) - { + for (int c = 1; c <= m; c++) { /* Check if assignment of color c to v is fine*/ - if (isSafe(v, graph, color, c)) - { + if (isSafe(v, graph, color, c)) { color[v] = c; /* recur to assign colors to rest of the vertices */ @@ -45,17 +40,14 @@ void graphColoring(bool graph[V][V], int m, int color[], int v) } /* A utility function to print solution */ -void printSolution(int color[]) -{ +void printSolution(int color[]) { printf(" Following are the assigned colors \n"); - for (int i = 0; i < V; i++) - printf(" %d ", color[i]); + for (int i = 0; i < V; i++) printf(" %d ", color[i]); printf("\n"); } // driver program to test above function -int main() -{ +int main() { /* Create following graph and test whether it is 3 colorable (3)---(2) | / | @@ -69,12 +61,11 @@ int main() {1, 1, 0, 1}, {1, 0, 1, 0}, }; - int m = 3; // Number of colors + int m = 3; // Number of colors int color[V]; - for (int i = 0; i < V; i++) - color[i] = 0; + for (int i = 0; i < V; i++) color[i] = 0; graphColoring(graph, m, color, 0); return 0; diff --git a/backtracking/knight_tour.cpp b/backtracking/knight_tour.cpp index fbb8a6f96..c97523be7 100644 --- a/backtracking/knight_tour.cpp +++ b/backtracking/knight_tour.cpp @@ -1,68 +1,60 @@ #include -# define n 8 +#define n 8 /** A knight's tour is a sequence of moves of a knight on a chessboard -such that the knight visits every square only once. If the knight -ends on a square that is one knight's move from the beginning -square (so that it could tour the board again immediately, following +such that the knight visits every square only once. If the knight +ends on a square that is one knight's move from the beginning +square (so that it could tour the board again immediately, following the same path), the tour is closed; otherwise, it is open. **/ -using namespace std; -bool issafe(int x,int y,int sol[n][n]) -{ - return (x=0 && y=0 && sol[x][y]==-1); +using std::cin; +using std::cout; +bool issafe(int x, int y, int sol[n][n]) { + return (x < n && x >= 0 && y < n && y >= 0 && sol[x][y] == -1); } -bool solve(int x,int y, int mov, int sol[n][n], int xmov[n], int ymov[n]) -{ - int k,xnext,ynext; +bool solve(int x, int y, int mov, int sol[n][n], int xmov[n], int ymov[n]) { + int k, xnext, ynext; - if(mov == n*n) + if (mov == n * n) return true; - for(k=0;k<8;k++) - { - xnext=x+xmov[k]; - ynext=y+ymov[k]; + for (k = 0; k < 8; k++) { + xnext = x + xmov[k]; + ynext = y + ymov[k]; - if(issafe(xnext,ynext,sol)) - { - sol[xnext][ynext]=mov; + if (issafe(xnext, ynext, sol)) { + sol[xnext][ynext] = mov; - if(solve(xnext,ynext,mov+1,sol,xmov,ymov)==true) - return true; - else - sol[xnext][ynext]=-1; - } + if (solve(xnext, ynext, mov + 1, sol, xmov, ymov) == true) + return true; + else + sol[xnext][ynext] = -1; + } } return false; } -int main() -{ - //initialize(); +int main() { + // initialize(); int sol[n][n]; - int i,j; - for(i=0;i scores, } int main() { - vector scores = { 90, 23, 6, 33, 21, 65, 123, 34423 }; + vector scores = {90, 23, 6, 33, 21, 65, 123, 34423}; int height = log2(scores.size()); cout << "Optimal value: " << minimax(0, 0, true, scores, height) << endl; diff --git a/backtracking/n_queens.cpp b/backtracking/n_queens.cpp index 472aaa2fe..8aab5df7b 100644 --- a/backtracking/n_queens.cpp +++ b/backtracking/n_queens.cpp @@ -2,19 +2,15 @@ #define N 4 using namespace std; -void printSolution(int board[N][N]) -{ +void printSolution(int board[N][N]) { cout << "\n"; - for (int i = 0; i < N; i++) - { - for (int j = 0; j < N; j++) - cout << "" << board[i][j]; + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) cout << "" << board[i][j]; cout << "\n"; } } -bool isSafe(int board[N][N], int row, int col) -{ +bool isSafe(int board[N][N], int row, int col) { int i, j; /* Check this row on left side */ @@ -35,23 +31,18 @@ bool isSafe(int board[N][N], int row, int col) return true; } -void solveNQ(int board[N][N], int col) -{ - - if (col >= N) - { +void solveNQ(int board[N][N], int col) { + if (col >= N) { printSolution(board); return; } /* Consider this column and try placing this queen in all rows one by one */ - for (int i = 0; i < N; i++) - { + for (int i = 0; i < N; i++) { /* Check if queen can be placed on board[i][col] */ - if (isSafe(board, i, col)) - { + if (isSafe(board, i, col)) { /* Place this queen in board[i][col] */ // cout<<"\n"< #define n 4 -#define inc_loop(var, start, stop) for (int var=start; var <= stop; var++) -#define dec_loop(var, start, stop) for (int var=start; var >= stop; var--) +#define inc_loop(var, start, stop) for (int var = start; var <= stop; var++) +#define dec_loop(var, start, stop) for (int var = start; var >= stop; var--) void PrintSol(int Board[n][n]) { - inc_loop(i, 0, n-1) { - inc_loop(j, 0, n-1) - std::cout << Board[i][j] << " "; + inc_loop(i, 0, n - 1) { + inc_loop(j, 0, n - 1) std::cout << Board[i][j] << " "; std::cout << std::endl; } std::cout << std::endl; - if (n%2 == 0 || (n%2 == 1 && Board[n/2+1][0] != 1)) { - inc_loop(i, 0, n-1) { - dec_loop(j, n-1, 0) - std::cout << Board[i][j] << " "; + if (n % 2 == 0 || (n % 2 == 1 && Board[n / 2 + 1][0] != 1)) { + inc_loop(i, 0, n - 1) { + dec_loop(j, n - 1, 0) std::cout << Board[i][j] << " "; std::cout << std::endl; } std::cout << std::endl; @@ -21,7 +19,7 @@ void PrintSol(int Board[n][n]) { bool CanIMove(int Board[n][n], int row, int col) { /// check in the row - inc_loop(i, 0, col-1) { + inc_loop(i, 0, col - 1) { if (Board[row][i] == 1) return false; } @@ -43,7 +41,7 @@ void NQueenSol(int Board[n][n], int col) { PrintSol(Board); return; } - inc_loop(i, 0, n-1) { + inc_loop(i, 0, n - 1) { if (CanIMove(Board, i, col)) { Board[i][col] = 1; NQueenSol(Board, col + 1); @@ -54,8 +52,8 @@ void NQueenSol(int Board[n][n], int col) { int main() { int Board[n][n] = {0}; - if (n%2 == 0) { - inc_loop(i, 0, n/2-1) { + if (n % 2 == 0) { + inc_loop(i, 0, n / 2 - 1) { if (CanIMove(Board, i, 0)) { Board[i][0] = 1; NQueenSol(Board, 1); @@ -63,7 +61,7 @@ int main() { } } } else { - inc_loop(i, 0, n/2) { + inc_loop(i, 0, n / 2) { if (CanIMove(Board, i, 0)) { Board[i][0] = 1; NQueenSol(Board, 1); diff --git a/backtracking/rat_maze.cpp b/backtracking/rat_maze.cpp index 307b5c7b0..fb3be4451 100644 --- a/backtracking/rat_maze.cpp +++ b/backtracking/rat_maze.cpp @@ -1,73 +1,62 @@ /* - A Maze is given as N*N binary matrix of blocks where source block is the upper - left most block i.e., maze[0][0] and destination block is lower rightmost - block i.e., maze[N-1][N-1]. A rat starts from source and has to reach destination. - The rat can move only in two directions: forward and down. In the maze matrix, - 0 means the block is dead end and 1 means the block can be used in the path - from source to destination. + A Maze is given as N*N binary matrix of blocks where source block is the + upper left most block i.e., maze[0][0] and destination block is lower + rightmost block i.e., maze[N-1][N-1]. A rat starts from source and has to + reach destination. The rat can move only in two directions: forward and down. + In the maze matrix, 0 means the block is dead end and 1 means the block can + be used in the path from source to destination. */ #include #define size 4 using namespace std; -int solveMaze(int currposrow, int currposcol, int maze[size][size], int soln[size][size]) -{ - if ((currposrow == size - 1) && (currposcol == size - 1)) - { - soln[currposrow][currposcol] = 1; - for (int i = 0; i < size; ++i) - { - for (int j = 0; j < size; ++j) - { - cout << soln[i][j]; - } - cout << endl; - } - return 1; - } - else - { - soln[currposrow][currposcol] = 1; +int solveMaze(int currposrow, int currposcol, int maze[size][size], + int soln[size][size]) { + if ((currposrow == size - 1) && (currposcol == size - 1)) { + soln[currposrow][currposcol] = 1; + for (int i = 0; i < size; ++i) { + for (int j = 0; j < size; ++j) { + cout << soln[i][j]; + } + cout << endl; + } + return 1; + } else { + soln[currposrow][currposcol] = 1; - // if there exist a solution by moving one step ahead in a collumn - if ((currposcol < size - 1) && maze[currposrow][currposcol + 1] == 1 && solveMaze(currposrow, currposcol + 1, maze, soln)) - { - return 1; - } + // if there exist a solution by moving one step ahead in a collumn + if ((currposcol < size - 1) && maze[currposrow][currposcol + 1] == 1 && + solveMaze(currposrow, currposcol + 1, maze, soln)) { + return 1; + } - // if there exists a solution by moving one step ahead in a row - if ((currposrow < size - 1) && maze[currposrow + 1][currposcol] == 1 && solveMaze(currposrow + 1, currposcol, maze, soln)) - { - return 1; - } + // if there exists a solution by moving one step ahead in a row + if ((currposrow < size - 1) && maze[currposrow + 1][currposcol] == 1 && + solveMaze(currposrow + 1, currposcol, maze, soln)) { + return 1; + } - // the backtracking part - soln[currposrow][currposcol] = 0; - return 0; - } + // the backtracking part + soln[currposrow][currposcol] = 0; + return 0; + } } -int main(int argc, char const *argv[]) -{ - int maze[size][size] = { - {1, 0, 1, 0}, - {1, 0, 1, 1}, - {1, 0, 0, 1}, - {1, 1, 1, 1}}; +int main(int argc, char const *argv[]) { + int maze[size][size] = { + {1, 0, 1, 0}, {1, 0, 1, 1}, {1, 0, 0, 1}, {1, 1, 1, 1}}; - int soln[size][size]; + int soln[size][size]; - for (int i = 0; i < size; ++i) - { - for (int j = 0; j < size; ++j) - { - soln[i][j] = 0; - } - } + for (int i = 0; i < size; ++i) { + for (int j = 0; j < size; ++j) { + soln[i][j] = 0; + } + } - int currposrow = 0; - int currposcol = 0; - solveMaze(currposrow, currposcol, maze, soln); - return 0; + int currposrow = 0; + int currposcol = 0; + solveMaze(currposrow, currposcol, maze, soln); + return 0; } diff --git a/backtracking/sudoku_solve.cpp b/backtracking/sudoku_solve.cpp index 6a01fd395..b712b6ec7 100644 --- a/backtracking/sudoku_solve.cpp +++ b/backtracking/sudoku_solve.cpp @@ -1,15 +1,12 @@ #include using namespace std; -///N=9; +/// N=9; int n = 9; -bool isPossible(int mat[][9], int i, int j, int no) -{ - ///Row or col nahin hona chahiye - for (int x = 0; x < n; x++) - { - if (mat[x][j] == no || mat[i][x] == no) - { +bool isPossible(int mat[][9], int i, int j, int no) { + /// Row or col nahin hona chahiye + for (int x = 0; x < n; x++) { + if (mat[x][j] == no || mat[i][x] == no) { return false; } } @@ -18,12 +15,9 @@ bool isPossible(int mat[][9], int i, int j, int no) int sx = (i / 3) * 3; int sy = (j / 3) * 3; - for (int x = sx; x < sx + 3; x++) - { - for (int y = sy; y < sy + 3; y++) - { - if (mat[x][y] == no) - { + for (int x = sx; x < sx + 3; x++) { + for (int y = sy; y < sy + 3; y++) { + if (mat[x][y] == no) { return false; } } @@ -31,83 +25,63 @@ bool isPossible(int mat[][9], int i, int j, int no) return true; } -void printMat(int mat[][9]) -{ - - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { +void printMat(int mat[][9]) { + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { cout << mat[i][j] << " "; - if ((j + 1) % 3 == 0) - { + if ((j + 1) % 3 == 0) { cout << '\t'; } } - if ((i + 1) % 3 == 0) - { + if ((i + 1) % 3 == 0) { cout << endl; } cout << endl; } } -bool solveSudoku(int mat[][9], int i, int j) -{ - ///Base Case - if (i == 9) - { - ///Solve kr chuke hain for 9 rows already +bool solveSudoku(int mat[][9], int i, int j) { + /// Base Case + if (i == 9) { + /// Solve kr chuke hain for 9 rows already printMat(mat); return true; } - ///Crossed the last Cell in the row - if (j == 9) - { + /// Crossed the last Cell in the row + if (j == 9) { return solveSudoku(mat, i + 1, 0); } - ///Blue Cell - Skip - if (mat[i][j] != 0) - { + /// Blue Cell - Skip + if (mat[i][j] != 0) { return solveSudoku(mat, i, j + 1); } - ///White Cell - ///Try to place every possible no - for (int no = 1; no <= 9; no++) - { - if (isPossible(mat, i, j, no)) - { - ///Place the no - assuming solution aa jayega + /// White Cell + /// Try to place every possible no + for (int no = 1; no <= 9; no++) { + if (isPossible(mat, i, j, no)) { + /// Place the no - assuming solution aa jayega mat[i][j] = no; bool aageKiSolveHui = solveSudoku(mat, i, j + 1); - if (aageKiSolveHui) - { + if (aageKiSolveHui) { return true; } - ///Nahin solve hui - ///loop will place the next no. + /// Nahin solve hui + /// loop will place the next no. } } - ///Sare no try kr liey, kisi se bhi solve nahi hui + /// Sare no try kr liey, kisi se bhi solve nahi hui mat[i][j] = 0; return false; } -int main() -{ - - int mat[9][9] = - {{5, 3, 0, 0, 7, 0, 0, 0, 0}, - {6, 0, 0, 1, 9, 5, 0, 0, 0}, - {0, 9, 8, 0, 0, 0, 0, 6, 0}, - {8, 0, 0, 0, 6, 0, 0, 0, 3}, - {4, 0, 0, 8, 0, 3, 0, 0, 1}, - {7, 0, 0, 0, 2, 0, 0, 0, 6}, - {0, 6, 0, 0, 0, 0, 2, 8, 0}, - {0, 0, 0, 4, 1, 9, 0, 0, 5}, - {0, 0, 0, 0, 8, 0, 0, 7, 9}}; +int main() { + int mat[9][9] = {{5, 3, 0, 0, 7, 0, 0, 0, 0}, {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9}}; printMat(mat); cout << "Solution " << endl; diff --git a/computer_oriented_statistical_methods/Bisection_method.CPP b/computer_oriented_statistical_methods/Bisection_method.CPP deleted file mode 100644 index 717987321..000000000 --- a/computer_oriented_statistical_methods/Bisection_method.CPP +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include - -float eq(float i) -{ - return (pow(i, 3) - (4 * i) - 9); // original equation -} - -void main() -{ - float a, b, x, z; - clrscr(); - for (int i = 0; i < 100; i++) - { - z = eq(i); - if (z >= 0) - { - b = i; - a = --i; - goto START; - } - } - -START: - - cout << "\nFirst initial: " << a; - cout << "\nSecond initial: " << b; - for (i = 0; i < 100; i++) - { - x = (a + b) / 2; - z = eq(x); - cout << "\n\nz: " << z << "\t[" << a << " , " << b << " | Bisect: " << x << "]"; - - if (z < 0) - { - a = x; - } - else - { - b = x; - } - - if (z > 0 && z < 0.0009) // stoping criteria - { - goto END; - } - } - -END: - cout << "\n\nRoot: " << x; - getch(); -} diff --git a/computer_oriented_statistical_methods/CMakeLists.txt b/computer_oriented_statistical_methods/CMakeLists.txt new file mode 100644 index 000000000..acff1ed1c --- /dev/null +++ b/computer_oriented_statistical_methods/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/stats") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/computer_oriented_statistical_methods/Gaussian_elimination.cpp b/computer_oriented_statistical_methods/Gaussian_elimination.cpp deleted file mode 100644 index 58e634505..000000000 --- a/computer_oriented_statistical_methods/Gaussian_elimination.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -using namespace std; - -int main() -{ - int mat_size, i, j, step; - - cout << "Matrix size: "; - cin >> mat_size; - - double mat[mat_size + 1][mat_size + 1], x[mat_size][mat_size + 1]; - - cout << endl - << "Enter value of the matrix: " << endl; - for (i = 0; i < mat_size; i++) - { - for (j = 0; j <= mat_size; j++) - { - cin >> mat[i][j]; //Enter (mat_size*mat_size) value of the matrix. - } - } - - for (step = 0; step < mat_size - 1; step++) - { - for (i = step; i < mat_size - 1; i++) - { - double a = (mat[i + 1][step] / mat[step][step]); - - for (j = step; j <= mat_size; j++) - mat[i + 1][j] = mat[i + 1][j] - (a * mat[step][j]); - } - } - - cout << endl - << "Matrix using Gaussian Elimination method: " << endl; - for (i = 0; i < mat_size; i++) - { - for (j = 0; j <= mat_size; j++) - { - x[i][j] = mat[i][j]; - cout << mat[i][j] << " "; - } - cout << endl; - } - cout << endl - << "Value of the Gaussian Elimination method: " << endl; - for (i = mat_size - 1; i >= 0; i--) - { - double sum = 0; - for (j = mat_size - 1; j > i; j--) - { - x[i][j] = x[j][j] * x[i][j]; - sum = x[i][j] + sum; - } - if (x[i][i] == 0) - x[i][i] = 0; - else - x[i][i] = (x[i][mat_size] - sum) / (x[i][i]); - - cout << "x" << i << "= " << x[i][i] << endl; - } - return 0; -} diff --git a/computer_oriented_statistical_methods/Newton_Raphson.CPP b/computer_oriented_statistical_methods/Newton_Raphson.CPP deleted file mode 100644 index 183a78daf..000000000 --- a/computer_oriented_statistical_methods/Newton_Raphson.CPP +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include - -float eq(float i) -{ - return (pow(i, 3) - (4 * i) - 9); // original equation -} -float eq_der(float i) -{ - return ((3 * pow(i, 2)) - 4); // derivative of equation -} - -void main() -{ - float a, b, z, c, m, n; - clrscr(); - for (int i = 0; i < 100; i++) - { - z = eq(i); - if (z >= 0) - { - b = i; - a = --i; - goto START; - } - } - -START: - - cout << "\nFirst initial: " << a; - cout << "\nSecond initial: " << b; - c = (a + b) / 2; - - for (i = 0; i < 100; i++) - { - float h; - m = eq(c); - n = eq_der(c); - - z = c - (m / n); - c = z; - - if (m > 0 && m < 0.009) // stoping criteria - { - goto END; - } - } - -END: - cout << "\n\nRoot: " << z; - getch(); -} diff --git a/computer_oriented_statistical_methods/Secant_method.CPP b/computer_oriented_statistical_methods/Secant_method.CPP deleted file mode 100644 index b897e9184..000000000 --- a/computer_oriented_statistical_methods/Secant_method.CPP +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -float eq(float i) -{ - return (pow(i, 3) - (4 * i) - 9); // original equation -} - -void main() -{ - float a, b, z, c, m, n; - clrscr(); - for (int i = 0; i < 100; i++) - { - z = eq(i); - if (z >= 0) - { - b = i; - a = --i; - goto START; - } - } - -START: - - cout << "\nFirst initial: " << a; - cout << "\nSecond initial: " << b; - for (i = 0; i < 100; i++) - { - float h, d; - m = eq(a); - n = eq(b); - - c = ((a * n) - (b * m)) / (n - m); - a = b; - b = c; - - z = eq(c); - if (z > 0 && z < 0.09) // stoping criteria - { - goto END; - } - } - -END: - cout << "\n\nRoot: " << c; - getch(); -} diff --git a/computer_oriented_statistical_methods/bisection_method.cpp b/computer_oriented_statistical_methods/bisection_method.cpp new file mode 100644 index 000000000..c93c529d2 --- /dev/null +++ b/computer_oriented_statistical_methods/bisection_method.cpp @@ -0,0 +1,75 @@ +/** + * \file + * \brief Solve the equation \f$f(x)=0\f$ using [bisection + * method](https://en.wikipedia.org/wiki/Bisection_method) + * + * Given two points \f$a\f$ and \f$b\f$ such that \f$f(a)<0\f$ and + * \f$f(b)>0\f$, then the \f$(i+1)^\text{th}\f$ approximation is given by: \f[ + * x_{i+1} = \frac{a_i+b_i}{2} + * \f] + * For the next iteration, the interval is selected + * as: \f$[a,x]\f$ if \f$x>0\f$ or \f$[x,b]\f$ if \f$x<0\f$. The Process is + * continued till a close enough approximation is achieved. + * + * \see newton_raphson_method.cpp, false_position.cpp, secant_method.cpp + */ +#include +#include +#include + +#define EPSILON \ + 1e-6 // std::numeric_limits::epsilon() ///< system accuracy limit +#define MAX_ITERATIONS 50000 ///< Maximum number of iterations to check + +/** define \f$f(x)\f$ to find root for + */ +static double eq(double i) { + return (std::pow(i, 3) - (4 * i) - 9); // original equation +} + +/** get the sign of any given number */ +template +int sgn(T val) { + return (T(0) < val) - (val < T(0)); +} + +/** main function */ +int main() { + double a = -1, b = 1, x, z; + int i; + + // loop to find initial intervals a, b + for (int i = 0; i < MAX_ITERATIONS; i++) { + z = eq(a); + x = eq(b); + if (sgn(z) == sgn(x)) { // same signs, increase interval + b++; + a--; + } else { // if opposite signs, we got our interval + break; + } + } + + std::cout << "\nFirst initial: " << a; + std::cout << "\nSecond initial: " << b; + + // start iterations + for (i = 0; i < MAX_ITERATIONS; i++) { + x = (a + b) / 2; + z = eq(x); + std::cout << "\n\nz: " << z << "\t[" << a << " , " << b + << " | Bisect: " << x << "]"; + + if (z < 0) { + a = x; + } else { + b = x; + } + + if (std::abs(z) < EPSILON) // stoping criteria + break; + } + + std::cout << "\n\nRoot: " << x << "\t\tSteps: " << i << std::endl; + return 0; +} diff --git a/computer_oriented_statistical_methods/false-position.cpp b/computer_oriented_statistical_methods/false-position.cpp deleted file mode 100644 index 5e15e92cc..000000000 --- a/computer_oriented_statistical_methods/false-position.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -float eq(float i) { - return (pow(i, 3) - (4 * i) - 9); // origial equation -} -int main() { - float a, b, z, c, m, n; - system("clear"); - for (int i = 0; i < 100; i++) { - z = eq(i); - if (z >= 0) { - b = i; - a = --i; - goto START; - } - } - START: - std::cout << "\nFirst initial: " << a; - std::cout << "\nSecond initial: " << b; - for (int i = 0; i < 100; i++) { - float h, d; - m = eq(a); - n = eq(b); - c = ((a * n) - (b * m)) / (n - m); - a = c; - z = eq(c); - if (z > 0 && z < 0.09) { // stoping criteria - goto END; - } - } - END: - std::cout << "\n\nRoot: " << c; - system("pause"); -} diff --git a/computer_oriented_statistical_methods/false_position.cpp b/computer_oriented_statistical_methods/false_position.cpp new file mode 100644 index 000000000..aebd154bb --- /dev/null +++ b/computer_oriented_statistical_methods/false_position.cpp @@ -0,0 +1,74 @@ +/** + * \file + * \brief Solve the equation \f$f(x)=0\f$ using [false position + * method](https://en.wikipedia.org/wiki/Regula_falsi), also known as the Secant + * method + * + * Given two points \f$a\f$ and \f$b\f$ such that \f$f(a)<0\f$ and + * \f$f(b)>0\f$, then the \f$(i+1)^\text{th}\f$ approximation is given by: \f[ + * x_{i+1} = \frac{a_i\cdot f(b_i) - b_i\cdot f(a_i)}{f(b_i) - f(a_i)} + * \f] + * For the next iteration, the interval is selected + * as: \f$[a,x]\f$ if \f$x>0\f$ or \f$[x,b]\f$ if \f$x<0\f$. The Process is + * continued till a close enough approximation is achieved. + * + * \see newton_raphson_method.cpp, bisection_method.cpp + */ +#include +#include +#include +#include + +#define EPSILON \ + 1e-6 // std::numeric_limits::epsilon() ///< system accuracy limit +#define MAX_ITERATIONS 50000 ///< Maximum number of iterations to check + +/** define \f$f(x)\f$ to find root for + */ +static double eq(double i) { + return (std::pow(i, 3) - (4 * i) - 9); // origial equation +} + +/** get the sign of any given number */ +template +int sgn(T val) { + return (T(0) < val) - (val < T(0)); +} + +/** main function */ +int main() { + double a = -1, b = 1, x, z, m, n, c; + int i; + + // loop to find initial intervals a, b + for (int i = 0; i < MAX_ITERATIONS; i++) { + z = eq(a); + x = eq(b); + if (sgn(z) == sgn(x)) { // same signs, increase interval + b++; + a--; + } else { // if opposite signs, we got our interval + break; + } + } + + std::cout << "\nFirst initial: " << a; + std::cout << "\nSecond initial: " << b; + + for (i = 0; i < MAX_ITERATIONS; i++) { + m = eq(a); + n = eq(b); + + c = ((a * n) - (b * m)) / (n - m); + + a = c; + z = eq(c); + + if (std::abs(z) < EPSILON) { // stoping criteria + break; + } + } + + std::cout << "\n\nRoot: " << c << "\t\tSteps: " << i << std::endl; + return 0; +} diff --git a/computer_oriented_statistical_methods/gaussian_elimination.cpp b/computer_oriented_statistical_methods/gaussian_elimination.cpp new file mode 100644 index 000000000..60b5648ec --- /dev/null +++ b/computer_oriented_statistical_methods/gaussian_elimination.cpp @@ -0,0 +1,76 @@ +/** + * \file + * \brief [Gaussian elimination + * method](https://en.wikipedia.org/wiki/Gaussian_elimination) + */ +#include + +/** Main function */ +int main() { + int mat_size, i, j, step; + + std::cout << "Matrix size: "; + std::cin >> mat_size; + + // create a 2D matrix by dynamic memory allocation + double **mat = new double *[mat_size + 1], **x = new double *[mat_size]; + for (i = 0; i <= mat_size; i++) { + mat[i] = new double[mat_size + 1]; + if (i < mat_size) + x[i] = new double[mat_size + 1]; + } + + // get the matrix elements from user + std::cout << std::endl << "Enter value of the matrix: " << std::endl; + for (i = 0; i < mat_size; i++) { + for (j = 0; j <= mat_size; j++) { + std::cin >> + mat[i][j]; // Enter (mat_size*mat_size) value of the matrix. + } + } + + // perform Gaussian elimination + for (step = 0; step < mat_size - 1; step++) { + for (i = step; i < mat_size - 1; i++) { + double a = (mat[i + 1][step] / mat[step][step]); + + for (j = step; j <= mat_size; j++) + mat[i + 1][j] = mat[i + 1][j] - (a * mat[step][j]); + } + } + + std::cout << std::endl + << "Matrix using Gaussian Elimination method: " << std::endl; + for (i = 0; i < mat_size; i++) { + for (j = 0; j <= mat_size; j++) { + x[i][j] = mat[i][j]; + std::cout << mat[i][j] << " "; + } + std::cout << std::endl; + } + std::cout << std::endl + << "Value of the Gaussian Elimination method: " << std::endl; + for (i = mat_size - 1; i >= 0; i--) { + double sum = 0; + for (j = mat_size - 1; j > i; j--) { + x[i][j] = x[j][j] * x[i][j]; + sum = x[i][j] + sum; + } + if (x[i][i] == 0) + x[i][i] = 0; + else + x[i][i] = (x[i][mat_size] - sum) / (x[i][i]); + + std::cout << "x" << i << "= " << x[i][i] << std::endl; + } + + for (i = 0; i <= mat_size; i++) { + delete[] mat[i]; + if (i < mat_size) + delete[] x[i]; + } + delete[] mat; + delete[] x; + + return 0; +} diff --git a/computer_oriented_statistical_methods/newton_raphson_method.cpp b/computer_oriented_statistical_methods/newton_raphson_method.cpp new file mode 100644 index 000000000..318363a39 --- /dev/null +++ b/computer_oriented_statistical_methods/newton_raphson_method.cpp @@ -0,0 +1,57 @@ +/** + * \file + * \brief Solve the equation \f$f(x)=0\f$ using [Newton-Raphson + * method](https://en.wikipedia.org/wiki/Newton%27s_method) + * + * The \f$(i+1)^\text{th}\f$ approximation is given by: + * \f[ + * x_{i+1} = x_i - \frac{f(x_i)}{f'(x_i)} + * \f] + * + * \see bisection_method.cpp, false_position.cpp + */ +#include +#include +#include +#include + +#define EPSILON \ + 1e-6 // std::numeric_limits::epsilon() ///< system accuracy limit +#define MAX_ITERATIONS 50000 ///< Maximum number of iterations to check + +/** define \f$f(x)\f$ to find root for + */ +static double eq(double i) { + return (std::pow(i, 3) - (4 * i) - 9); // original equation +} + +/** define the derivative function \f$f'(x)\f$ + */ +static double eq_der(double i) { + return ((3 * std::pow(i, 2)) - 4); // derivative of equation +} + +/** Main function */ +int main() { + std::srand(std::time(nullptr)); // initialize randomizer + + double z, c = std::rand() % 100, m, n; + int i; + + std::cout << "\nInitial approximation: " << c; + + // start iterations + for (i = 0; i < MAX_ITERATIONS; i++) { + m = eq(c); + n = eq_der(c); + + z = c - (m / n); + c = z; + + if (std::abs(m) < EPSILON) // stoping criteria + break; + } + + std::cout << "\n\nRoot: " << z << "\t\tSteps: " << i << std::endl; + return 0; +} diff --git a/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp b/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp index f50ccf1b1..de02b27bb 100644 --- a/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp +++ b/computer_oriented_statistical_methods/ordinary_least_squares_regressor.cpp @@ -1,349 +1,405 @@ /** + * @file + * \brief Linear regression example using [Ordinary least + * squares](https://en.wikipedia.org/wiki/Ordinary_least_squares) + * * Program that gets the number of data samples and number of features per * sample along with output per sample. It applies OLS regression to compute * the regression output for additional test data samples. - **/ -#include + */ +#include // for print formatting #include #include +/** + * operator to print a matrix + */ template std::ostream &operator<<(std::ostream &out, std::vector> const &v) { - const int width = 10; - const char separator = ' '; + const int width = 10; + const char separator = ' '; - for (size_t row = 0; row < v.size(); row++) { - for (size_t col = 0; col < v[row].size(); col++) - out << std::left << std::setw(width) << std::setfill(separator) - << v[row][col]; - out << std::endl; - } + for (size_t row = 0; row < v.size(); row++) { + for (size_t col = 0; col < v[row].size(); col++) + out << std::left << std::setw(width) << std::setfill(separator) + << v[row][col]; + out << std::endl; + } - return out; -} - -template -std::ostream &operator<<(std::ostream &out, std::vector const &v) { - const int width = 15; - const char separator = ' '; - - for (size_t row = 0; row < v.size(); row++) - out << std::left << std::setw(width) << std::setfill(separator) << v[row]; - - return out; -} - -template -inline bool is_square(std::vector> const &A) { - // Assuming A is square matrix - size_t N = A.size(); - for (size_t i = 0; i < N; i++) - if (A[i].size() != N) - return false; - return true; + return out; } /** - * matrix multiplication + * operator to print a vector + */ +template +std::ostream &operator<<(std::ostream &out, std::vector const &v) { + const int width = 15; + const char separator = ' '; + + for (size_t row = 0; row < v.size(); row++) + out << std::left << std::setw(width) << std::setfill(separator) + << v[row]; + + return out; +} + +/** + * function to check if given matrix is a square matrix + * \returns 1 if true, 0 if false + */ +template +inline bool is_square(std::vector> const &A) { + // Assuming A is square matrix + size_t N = A.size(); + for (size_t i = 0; i < N; i++) + if (A[i].size() != N) + return false; + return true; +} + +/** + * Matrix multiplication such that if A is size (mxn) and + * B is of size (pxq) then the multiplication is defined + * only when n = p and the resultant matrix is of size (mxq) + * + * \returns resultant matrix **/ template std::vector> operator*(std::vector> const &A, std::vector> const &B) { - // Number of rows in A - size_t N_A = A.size(); - // Number of columns in B - size_t N_B = B[0].size(); + // Number of rows in A + size_t N_A = A.size(); + // Number of columns in B + size_t N_B = B[0].size(); - std::vector> result(N_A); + std::vector> result(N_A); - if (A[0].size() != B.size()) { - std::cerr << "Number of columns in A != Number of rows in B (" - << A[0].size() << ", " << B.size() << ")" << std::endl; - return result; - } - - for (size_t row = 0; row < N_A; row++) { - std::vector v(N_B); - for (size_t col = 0; col < N_B; col++) { - v[col] = static_cast(0); - for (size_t j = 0; j < B.size(); j++) - v[col] += A[row][j] * B[j][col]; + if (A[0].size() != B.size()) { + std::cerr << "Number of columns in A != Number of rows in B (" + << A[0].size() << ", " << B.size() << ")" << std::endl; + return result; } - result[row] = v; - } - return result; -} + for (size_t row = 0; row < N_A; row++) { + std::vector v(N_B); + for (size_t col = 0; col < N_B; col++) { + v[col] = static_cast(0); + for (size_t j = 0; j < B.size(); j++) + v[col] += A[row][j] * B[j][col]; + } + result[row] = v; + } -template -std::vector operator*(std::vector> const &A, - std::vector const &B) { - // Number of rows in A - size_t N_A = A.size(); - - std::vector result(N_A); - - if (A[0].size() != B.size()) { - std::cerr << "Number of columns in A != Number of rows in B (" - << A[0].size() << ", " << B.size() << ")" << std::endl; return result; - } - - for (size_t row = 0; row < N_A; row++) { - result[row] = static_cast(0); - for (size_t j = 0; j < B.size(); j++) - result[row] += A[row][j] * B[j]; - } - - return result; -} - -template -std::vector operator*(float const scalar, std::vector const &A) { - // Number of rows in A - size_t N_A = A.size(); - - std::vector result(N_A); - - for (size_t row = 0; row < N_A; row++) { - result[row] += A[row] * static_cast(scalar); - } - - return result; -} - -template -std::vector operator*(std::vector const &A, float const scalar) { - // Number of rows in A - size_t N_A = A.size(); - - std::vector result(N_A); - - for (size_t row = 0; row < N_A; row++) - result[row] = A[row] * static_cast(scalar); - - return result; -} - -template -std::vector operator/(std::vector const &A, float const scalar) { - return (1.f / scalar) * A; -} - -template -std::vector operator-(std::vector const &A, std::vector const &B) { - // Number of rows in A - size_t N = A.size(); - - std::vector result(N); - - if (B.size() != N) { - std::cerr << "Vector dimensions shouldbe identical!" << std::endl; - return A; - } - - for (size_t row = 0; row < N; row++) - result[row] = A[row] - B[row]; - - return result; -} - -template -std::vector operator+(std::vector const &A, std::vector const &B) { - // Number of rows in A - size_t N = A.size(); - - std::vector result(N); - - if (B.size() != N) { - std::cerr << "Vector dimensions shouldbe identical!" << std::endl; - return A; - } - - for (size_t row = 0; row < N; row++) - result[row] = A[row] + B[row]; - - return result; } /** - * Get matrix inverse using Row-trasnformations + * multiplication of a matrix with a column vector + * \returns resultant vector + */ +template +std::vector operator*(std::vector> const &A, + std::vector const &B) { + // Number of rows in A + size_t N_A = A.size(); + + std::vector result(N_A); + + if (A[0].size() != B.size()) { + std::cerr << "Number of columns in A != Number of rows in B (" + << A[0].size() << ", " << B.size() << ")" << std::endl; + return result; + } + + for (size_t row = 0; row < N_A; row++) { + result[row] = static_cast(0); + for (size_t j = 0; j < B.size(); j++) result[row] += A[row][j] * B[j]; + } + + return result; +} + +/** + * pre-multiplication of a vector by a scalar + * \returns resultant vector + */ +template +std::vector operator*(float const scalar, std::vector const &A) { + // Number of rows in A + size_t N_A = A.size(); + + std::vector result(N_A); + + for (size_t row = 0; row < N_A; row++) { + result[row] += A[row] * static_cast(scalar); + } + + return result; +} + +/** + * post-multiplication of a vector by a scalar + * \returns resultant vector + */ +template +std::vector operator*(std::vector const &A, float const scalar) { + // Number of rows in A + size_t N_A = A.size(); + + std::vector result(N_A); + + for (size_t row = 0; row < N_A; row++) + result[row] = A[row] * static_cast(scalar); + + return result; +} + +/** + * division of a vector by a scalar + * \returns resultant vector + */ +template +std::vector operator/(std::vector const &A, float const scalar) { + return (1.f / scalar) * A; +} + +/** + * subtraction of two vectors of identical lengths + * \returns resultant vector + */ +template +std::vector operator-(std::vector const &A, std::vector const &B) { + // Number of rows in A + size_t N = A.size(); + + std::vector result(N); + + if (B.size() != N) { + std::cerr << "Vector dimensions shouldbe identical!" << std::endl; + return A; + } + + for (size_t row = 0; row < N; row++) result[row] = A[row] - B[row]; + + return result; +} + +/** + * addition of two vectors of identical lengths + * \returns resultant vector + */ +template +std::vector operator+(std::vector const &A, std::vector const &B) { + // Number of rows in A + size_t N = A.size(); + + std::vector result(N); + + if (B.size() != N) { + std::cerr << "Vector dimensions shouldbe identical!" << std::endl; + return A; + } + + for (size_t row = 0; row < N; row++) result[row] = A[row] + B[row]; + + return result; +} + +/** + * Get matrix inverse using Row-trasnformations. Given matrix must + * be a square and non-singular. + * \returns inverse matrix **/ template -std::vector> -get_inverse(std::vector> const &A) { - // Assuming A is square matrix - size_t N = A.size(); +std::vector> get_inverse( + std::vector> const &A) { + // Assuming A is square matrix + size_t N = A.size(); - std::vector> inverse(N); - for (size_t row = 0; row < N; row++) { - // preallocatae a resultant identity matrix - inverse[row] = std::vector(N); - for (size_t col = 0; col < N; col++) - inverse[row][col] = (row == col) ? 1.f : 0.f; - } + std::vector> inverse(N); + for (size_t row = 0; row < N; row++) { + // preallocatae a resultant identity matrix + inverse[row] = std::vector(N); + for (size_t col = 0; col < N; col++) + inverse[row][col] = (row == col) ? 1.f : 0.f; + } + + if (!is_square(A)) { + std::cerr << "A must be a square matrix!" << std::endl; + return inverse; + } + + // preallocatae a temporary matrix identical to A + std::vector> temp(N); + for (size_t row = 0; row < N; row++) { + std::vector v(N); + for (size_t col = 0; col < N; col++) + v[col] = static_cast(A[row][col]); + temp[row] = v; + } + + // start transformations + for (size_t row = 0; row < N; row++) { + for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) { + // this to ensure diagonal elements are not 0 + temp[row] = temp[row] + temp[row2]; + inverse[row] = inverse[row] + inverse[row2]; + } + + for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) { + // this to further ensure diagonal elements are not 0 + for (size_t row2 = 0; row2 < N; row2++) { + temp[row2][row] = temp[row2][row] + temp[row2][col2]; + inverse[row2][row] = inverse[row2][row] + inverse[row2][col2]; + } + } + + if (temp[row][row] == 0) { + // Probably a low-rank matrix and hence singular + std::cerr << "Low-rank matrix, no inverse!" << std::endl; + return inverse; + } + + // set diagonal to 1 + float divisor = static_cast(temp[row][row]); + temp[row] = temp[row] / divisor; + inverse[row] = inverse[row] / divisor; + // Row transformations + for (size_t row2 = 0; row2 < N; row2++) { + if (row2 == row) + continue; + float factor = temp[row2][row]; + temp[row2] = temp[row2] - factor * temp[row]; + inverse[row2] = inverse[row2] - factor * inverse[row]; + } + } - if (!is_square(A)) { - std::cerr << "A must be a square matrix!" << std::endl; return inverse; - } - - // preallocatae a temporary matrix identical to A - std::vector> temp(N); - for (size_t row = 0; row < N; row++) { - std::vector v(N); - for (size_t col = 0; col < N; col++) - v[col] = static_cast(A[row][col]); - temp[row] = v; - } - - // start transformations - for (size_t row = 0; row < N; row++) { - for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) { - // this to ensure diagonal elements are not 0 - temp[row] = temp[row] + temp[row2]; - inverse[row] = inverse[row] + inverse[row2]; - } - - for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) { - // this to further ensure diagonal elements are not 0 - for (size_t row2 = 0; row2 < N; row2++) { - temp[row2][row] = temp[row2][row] + temp[row2][col2]; - inverse[row2][row] = inverse[row2][row] + inverse[row2][col2]; - } - } - - if (temp[row][row] == 0) { - // Probably a low-rank matrix and hence singular - std::cerr << "Low-rank matrix, no inverse!" << std::endl; - return inverse; - } - - // set diagonal to 1 - float divisor = static_cast(temp[row][row]); - temp[row] = temp[row] / divisor; - inverse[row] = inverse[row] / divisor; - // Row transformations - for (size_t row2 = 0; row2 < N; row2++) { - if (row2 == row) - continue; - float factor = temp[row2][row]; - temp[row2] = temp[row2] - factor * temp[row]; - inverse[row2] = inverse[row2] - factor * inverse[row]; - } - } - - return inverse; } /** * matrix transpose + * \returns resultant matrix **/ template -std::vector> -get_transpose(std::vector> const &A) { - std::vector> result(A[0].size()); +std::vector> get_transpose( + std::vector> const &A) { + std::vector> result(A[0].size()); - for (size_t row = 0; row < A[0].size(); row++) { - std::vector v(A.size()); - for (size_t col = 0; col < A.size(); col++) - v[col] = A[col][row]; + for (size_t row = 0; row < A[0].size(); row++) { + std::vector v(A.size()); + for (size_t col = 0; col < A.size(); col++) v[col] = A[col][row]; - result[row] = v; - } - return result; + result[row] = v; + } + return result; } +/** + * Perform Ordinary Least Squares curve fit. This operation is defined as + * \f[\beta = \left(X^TXX^T\right)Y\f] + * \param X feature matrix with rows representing sample vector of features + * \param Y known regression value for each sample + * \returns fitted regression model polynomial coefficients + */ template std::vector fit_OLS_regressor(std::vector> const &X, std::vector const &Y) { - // NxF - std::vector> X2 = X; - for (size_t i = 0; i < X2.size(); i++) - // add Y-intercept -> Nx(F+1) - X2[i].push_back(1); - // (F+1)xN - std::vector> Xt = get_transpose(X2); - // (F+1)x(F+1) - std::vector> tmp = get_inverse(Xt * X2); - // (F+1)xN - std::vector> out = tmp * Xt; - // cout << endl - // << "Projection matrix: " << X2 * out << endl; + // NxF + std::vector> X2 = X; + for (size_t i = 0; i < X2.size(); i++) + // add Y-intercept -> Nx(F+1) + X2[i].push_back(1); + // (F+1)xN + std::vector> Xt = get_transpose(X2); + // (F+1)x(F+1) + std::vector> tmp = get_inverse(Xt * X2); + // (F+1)xN + std::vector> out = tmp * Xt; + // cout << endl + // << "Projection matrix: " << X2 * out << endl; - // Fx1,1 -> (F+1)^th element is the independent constant - return out * Y; + // Fx1,1 -> (F+1)^th element is the independent constant + return out * Y; } /** * Given data and OLS model coeffficients, predict - * regression estimates + * regression estimates. This operation is defined as + * \f[y_{\text{row}=i} = \sum_{j=\text{columns}}\beta_j\cdot X_{i,j}\f] + * + * \param X feature matrix with rows representing sample vector of features + * \param beta fitted regression model + * \return vector with regression values for each sample **/ template std::vector predict_OLS_regressor(std::vector> const &X, - std::vector const &beta) { - std::vector result(X.size()); + std::vector const &beta /**< */ +) { + std::vector result(X.size()); - for (size_t rows = 0; rows < X.size(); rows++) { - // -> start with constant term - result[rows] = beta[X[0].size()]; - for (size_t cols = 0; cols < X[0].size(); cols++) - result[rows] += beta[cols] * X[rows][cols]; - } - // Nx1 - return result; + for (size_t rows = 0; rows < X.size(); rows++) { + // -> start with constant term + result[rows] = beta[X[0].size()]; + for (size_t cols = 0; cols < X[0].size(); cols++) + result[rows] += beta[cols] * X[rows][cols]; + } + // Nx1 + return result; } +/** + * main function + */ int main() { - size_t N, F; + size_t N, F; - std::cout << "Enter number of features: "; - // number of features = columns - std::cin >> F; - std::cout << "Enter number of samples: "; - // number of samples = rows - std::cin >> N; + std::cout << "Enter number of features: "; + // number of features = columns + std::cin >> F; + std::cout << "Enter number of samples: "; + // number of samples = rows + std::cin >> N; - std::vector> data(N); - std::vector Y(N); + std::vector> data(N); + std::vector Y(N); - std::cout - << "Enter training data. Per sample, provide features ad one output." - << std::endl; + std::cout + << "Enter training data. Per sample, provide features ad one output." + << std::endl; - for (size_t rows = 0; rows < N; rows++) { - std::vector v(F); - std::cout << "Sample# " << rows + 1 << ": "; - for (size_t cols = 0; cols < F; cols++) - // get the F features - std::cin >> v[cols]; - data[rows] = v; - // get the corresponding output - std::cin >> Y[rows]; - } + for (size_t rows = 0; rows < N; rows++) { + std::vector v(F); + std::cout << "Sample# " << rows + 1 << ": "; + for (size_t cols = 0; cols < F; cols++) + // get the F features + std::cin >> v[cols]; + data[rows] = v; + // get the corresponding output + std::cin >> Y[rows]; + } - std::vector beta = fit_OLS_regressor(data, Y); - std::cout << std::endl << std::endl << "beta:" << beta << std::endl; + std::vector beta = fit_OLS_regressor(data, Y); + std::cout << std::endl << std::endl << "beta:" << beta << std::endl; - size_t T; - std::cout << "Enter number of test samples: "; - // number of test sample inputs - std::cin >> T; - std::vector> data2(T); - // vector Y2(T); + size_t T; + std::cout << "Enter number of test samples: "; + // number of test sample inputs + std::cin >> T; + std::vector> data2(T); + // vector Y2(T); - for (size_t rows = 0; rows < T; rows++) { - std::cout << "Sample# " << rows + 1 << ": "; - std::vector v(F); - for (size_t cols = 0; cols < F; cols++) - std::cin >> v[cols]; - data2[rows] = v; - } + for (size_t rows = 0; rows < T; rows++) { + std::cout << "Sample# " << rows + 1 << ": "; + std::vector v(F); + for (size_t cols = 0; cols < F; cols++) std::cin >> v[cols]; + data2[rows] = v; + } - std::vector out = predict_OLS_regressor(data2, beta); - for (size_t rows = 0; rows < T; rows++) - std::cout << out[rows] << std::endl; + std::vector out = predict_OLS_regressor(data2, beta); + for (size_t rows = 0; rows < T; rows++) std::cout << out[rows] << std::endl; - return 0; + return 0; } diff --git a/computer_oriented_statistical_methods/successive_approximation.CPP b/computer_oriented_statistical_methods/successive_approximation.CPP deleted file mode 100644 index b42ab8f8c..000000000 --- a/computer_oriented_statistical_methods/successive_approximation.CPP +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -float eq(float y) -{ - return ((3 * y) - (cos(y)) - 2); -} -float eqd(float y) -{ - return ((0.5) * ((cos(y)) + 2)); -} - -void main() -{ - float y, x1, x2, x3, sum, s, a, f1, f2, gd; - int i, n; - - clrscr(); - for (i = 0; i < 10; i++) - { - sum = eq(y); - cout << "value of equation at " << i << " " << sum << "\n"; - y++; - } - cout << "enter the x1->"; - cin >> x1; - cout << "enter the no iteration to perform->\n"; - cin >> n; - - for (i = 0; i <= n; i++) - { - x2 = eqd(x1); - cout << "\nenter the x2->" << x2; - x1 = x2; - } - getch(); -} \ No newline at end of file diff --git a/computer_oriented_statistical_methods/successive_approximation.cpp b/computer_oriented_statistical_methods/successive_approximation.cpp new file mode 100644 index 000000000..351382f24 --- /dev/null +++ b/computer_oriented_statistical_methods/successive_approximation.cpp @@ -0,0 +1,40 @@ +/** + * \file + * \brief Method of successive approximations using [fixed-point + * iteration](https://en.wikipedia.org/wiki/Fixed-point_iteration) method + */ +#include +#include + +/** equation 1 + * \f[f(y) = 3y - \cos y -2\f] + */ +static float eq(float y) { return (3 * y) - cos(y) - 2; } + +/** equation 2 + * \f[f(y) = \frac{\cos y+2}{2}\f] + */ +static float eqd(float y) { return 0.5 * (cos(y) + 2); } + +/** Main function */ +int main() { + float y, x1, x2, x3, sum, s, a, f1, f2, gd; + int i, n; + + for (i = 0; i < 10; i++) { + sum = eq(y); + std::cout << "value of equation at " << i << " " << sum << "\n"; + y++; + } + std::cout << "enter the x1->"; + std::cin >> x1; + std::cout << "enter the no iteration to perform->\n"; + std::cin >> n; + + for (i = 0; i <= n; i++) { + x2 = eqd(x1); + std::cout << "\nenter the x2->" << x2; + x1 = x2; + } + return 0; +} diff --git a/data_structure/AVLtree.cpp b/data_structure/AVLtree.cpp deleted file mode 100644 index db6b9e0d4..000000000 --- a/data_structure/AVLtree.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include - -using namespace std; - -typedef struct node -{ - int data; - int height; - struct node *left; - struct node *right; -} node; - -int max(int a, int b) -{ - return a > b ? a : b; -} - -// Returns a new Node - -node *createNode(int data) -{ - node *nn = new node(); - nn->data = data; - nn->height = 0; - nn->left = NULL; - nn->right = NULL; - return nn; -} - -// Returns height of tree - -int height(node *root) -{ - if (root == NULL) - return 0; - return 1 + max(height(root->left), height(root->right)); -} - -// Returns difference between height of left and right subtree - -int getBalance(node *root) -{ - return height(root->left) - height(root->right); -} - -// Returns Node after Right Rotation - -node *rightRotate(node *root) -{ - node *t = root->left; - node *u = t->right; - t->right = root; - root->left = u; - return t; -} - -// Returns Node after Left Rotation - -node *leftRotate(node *root) -{ - node *t = root->right; - node *u = t->left; - t->left = root; - root->right = u; - return t; -} - -// Returns node with minimum value in the tree - -node *minValue(node *root) -{ - if (root->left == NULL) - return root; - return minValue(root->left); -} - -// Balanced Insertion - -node *insert(node *root, int item) -{ - node *nn = createNode(item); - if (root == NULL) - return nn; - if (item < root->data) - root->left = insert(root->left, item); - else - root->right = insert(root->right, item); - int b = getBalance(root); - if (b > 1) - { - if (getBalance(root->left) < 0) - root->left = leftRotate(root->left); // Left-Right Case - return rightRotate(root); // Left-Left Case - } - else if (b < -1) - { - if (getBalance(root->right) > 0) - root->right = rightRotate(root->right); // Right-Left Case - return leftRotate(root); // Right-Right Case - } - return root; -} - -// Balanced Deletion - -node *deleteNode(node *root, int key) -{ - if (root == NULL) - return root; - if (key < root->data) - root->left = deleteNode(root->left, key); - else if (key > root->data) - root->right = deleteNode(root->right, key); - - else - { - // Node to be deleted is leaf node or have only one Child - if (!root->right) - { - node *temp = root->left; - delete (root); - root = NULL; - return temp; - } - else if (!root->left) - { - node *temp = root->right; - delete (root); - root = NULL; - return temp; - } - // Node to be deleted have both left and right subtrees - node *temp = minValue(root->right); - root->data = temp->data; - root->right = deleteNode(root->right, temp->data); - } - // Balancing Tree after deletion - return root; -} - -// LevelOrder (Breadth First Search) - -void levelOrder(node *root) -{ - queue q; - q.push(root); - while (!q.empty()) - { - root = q.front(); - cout << root->data << " "; - q.pop(); - if (root->left) - q.push(root->left); - if (root->right) - q.push(root->right); - } -} - -int main() -{ - // Testing AVL Tree - node *root = NULL; - int i; - for (i = 1; i <= 7; i++) - root = insert(root, i); - cout << "LevelOrder: "; - levelOrder(root); - root = deleteNode(root, 1); // Deleting key with value 1 - cout << "\nLevelOrder: "; - levelOrder(root); - root = deleteNode(root, 4); // Deletin key with value 4 - cout << "\nLevelOrder: "; - levelOrder(root); - return 0; -} diff --git a/data_structure/Binary Search Tree.cpp b/data_structure/Binary Search Tree.cpp deleted file mode 100644 index 32a65517c..000000000 --- a/data_structure/Binary Search Tree.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include -using namespace std; - -struct node -{ - int val; - node *left; - node *right; -}; - -struct queue -{ - node *t[100]; - int front; - int rear; -}; - -queue q; - -void enqueue(node *n) -{ - q.t[q.rear++] = n; -} - -node *dequeue() -{ - return (q.t[q.front++]); -} - -void Insert(node *n, int x) -{ - if (x < n->val) - { - if (n->left == NULL) - { - node *temp = new node; - temp->val = x; - temp->left = NULL; - temp->right = NULL; - n->left = temp; - } - else - { - Insert(n->left, x); - } - } - else - { - if (n->right == NULL) - { - node *temp = new node; - temp->val = x; - temp->left = NULL; - temp->right = NULL; - n->left = temp; - } - else - { - Insert(n->right, x); - } - } -} - -int findMaxInLeftST(node *n) -{ - while (n->right != NULL) - { - n = n->right; - } - return n->val; -} - -void Remove(node *p, node *n, int x) -{ - if (n->val == x) - { - if (n->right == NULL && n->left == NULL) - { - if (x < p->val) - { - p->right = NULL; - } - else - { - p->left = NULL; - } - } - else if (n->right == NULL) - { - if (x < p->val) - { - p->right = n->left; - } - else - { - p->left = n->left; - } - } - else if (n->left == NULL) - { - if (x < p->val) - { - p->right = n->right; - } - else - { - p->left = n->right; - } - } - else - { - int y = findMaxInLeftST(n->left); - n->val = y; - Remove(n, n->right, y); - } - } - else if (x < n->val) - { - Remove(n, n->left, x); - } - else - { - Remove(n, n->right, x); - } -} - -void BFT(node *n) -{ - if (n != NULL) - { - cout << n->val << " "; - enqueue(n->left); - enqueue(n->right); - BFT(dequeue()); - } -} - -void Pre(node *n) -{ - if (n != NULL) - { - cout << n->val << " "; - Pre(n->left); - Pre(n->right); - } -} - -void In(node *n) -{ - if (n != NULL) - { - In(n->left); - cout << n->val << " "; - In(n->right); - } -} - -void Post(node *n) -{ - if (n != NULL) - { - Post(n->left); - Post(n->right); - cout << n->val << " "; - } -} - -int main() -{ - q.front = 0; - q.rear = 0; - int value; - int ch; - node *root = new node; - cout << "\nEnter the value of root node :"; - cin >> value; - root->val = value; - root->left = NULL; - root->right = NULL; - do - { - cout << "\n1. Insert"; - cout << "\n2. Delete"; - cout << "\n3. Breadth First"; - cout << "\n4. Preorder Depth First"; - cout << "\n5. Inorder Depth First"; - cout << "\n6. Postorder Depth First"; - - cout << "\nEnter Your Choice : "; - cin >> ch; - int x; - switch (ch) - { - case 1: - cout << "\nEnter the value to be Inserted : "; - cin >> x; - Insert(root, x); - break; - case 2: - cout << "\nEnter the value to be Deleted : "; - cin >> x; - Remove(root, root, x); - break; - case 3: - BFT(root); - break; - case 4: - Pre(root); - break; - case 5: - In(root); - break; - case 6: - Post(root); - break; - } - } while (ch != 0); -} diff --git a/data_structure/List Array.cpp b/data_structure/List Array.cpp deleted file mode 100644 index de984876b..000000000 --- a/data_structure/List Array.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include -using namespace std; - -struct list -{ - int data[50]; - int top = 0; - bool isSorted = false; - - int BinarySearch(int *array, int first, int last, int x) - { - if (last < first) - { - return -1; - } - int mid = (first + last) / 2; - if (array[mid] == x) - return mid; - else if (x < array[mid]) - return (BinarySearch(array, first, mid - 1, x)); - else if (x > array[mid]) - return (BinarySearch(array, mid + 1, last, x)); - } - - int LinarSearch(int *array, int x) - { - for (int i = 0; i < top; i++) - { - if (array[i] == x) - { - return i; - } - } - - return -1; - } - - int Search(int x) - { - int pos = -1; - - if (isSorted) - { - pos = BinarySearch(data, 0, top - 1, x); - } - - else - { - pos = LinarSearch(data, x); - } - - if (pos != -1) - { - cout << "\nElement found at position : " << pos; - } - else - { - cout << "\nElement not found"; - } - return pos; - } - - void Sort() - { - int i, j, pos; - for (i = 0; i < top; i++) - { - int min = data[i]; - for (j = i + 1; j < top; j++) - { - if (data[j] < min) - { - pos = j; - min = data[pos]; - } - } - - int temp = data[i]; - data[i] = data[pos]; - data[pos] = temp; - } - isSorted = true; - } - - void insert(int x) - { - if (!isSorted) - { - - if (top == 49) - { - cout << "\nOverflow"; - } - else - { - data[top] = x; - top++; - } - } - - else - { - int pos = 0; - - for (int i = 0; i < top - 1; i++) - { - if (data[i] <= x && x <= data[i + 1]) - { - pos = i + 1; - break; - } - } - if (pos == 0) - { - pos = top - 1; - } - - for (int i = top; i > pos; i--) - { - data[i] = data[i - 1]; - } - top++; - data[pos] = x; - } - } - - void Remove(int x) - { - int pos = Search(x); - cout << "\n" - << data[pos] << " deleted"; - for (int i = pos; i < top; i++) - { - data[i] = data[i + 1]; - } - top--; - } - - void Show() - { - for (int i = 0; i < top; i++) - { - cout << data[i] << "\t"; - } - } -}; - -int main() -{ - list L; - int choice; - int x; - do - { - cout << "\n1.Insert"; - cout << "\n2.Delete"; - cout << "\n3.Search"; - cout << "\n4.Sort"; - cout << "\n5.Print"; - cout << "\n\nEnter Your Choice : "; - cin >> choice; - switch (choice) - { - case 1: - cout << "\nEnter the element to be inserted : "; - cin >> x; - L.insert(x); - break; - case 2: - cout << "\nEnter the element to be removed : "; - cin >> x; - L.Remove(x); - break; - case 3: - cout << "\nEnter the element to be searched : "; - cin >> x; - L.Search(x); - break; - case 4: - L.Sort(); - break; - case 5: - L.Show(); - break; - } - } while (choice != 0); - return 0; -} diff --git a/data_structure/MorrisInorder.cpp b/data_structure/MorrisInorder.cpp deleted file mode 100644 index d3a2e9fd7..000000000 --- a/data_structure/MorrisInorder.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -/************************** - @author shrutisheoran -**************************/ - -using namespace std; - -struct Btree -{ - int data; - struct Btree *left; //Pointer to left subtree - struct Btree *right; //Pointer to right subtree -}; - -void insert(Btree **root, int d) -{ - Btree *nn = new Btree(); //Creating new node - nn->data = d; - nn->left = NULL; - nn->right = NULL; - if (*root == NULL) - { - *root = nn; - return; - } - else - { - queue q; - // Adding root node to queue - q.push(*root); - while (!q.empty()) - { - Btree *node = q.front(); - // Removing parent node from queue - q.pop(); - if (node->left) - // Adding left child of removed node to queue - q.push(node->left); - else - { - // Adding new node if no left child is present - node->left = nn; - return; - } - if (node->right) - // Adding right child of removed node to queue - q.push(node->right); - else - { - // Adding new node if no right child is present - node->right = nn; - return; - } - } - } -} - -void morrisInorder(Btree *root) -{ - Btree *curr = root; - Btree *temp; - while (curr) - { - if (curr->left == NULL) - { - cout << curr->data << " "; - // If left of current node is NULL then curr is shifted to right - curr = curr->right; - } - else - { - // Left of current node is stored in temp - temp = curr->left; - // Moving to extreme right of temp - while (temp->right && temp->right != curr) - temp = temp->right; - // If extreme right is null it is made to point to currrent node (will be used for backtracking) - if (temp->right == NULL) - { - temp->right = curr; - // current node is made to point its left subtree - curr = curr->left; - } - // If extreme right already points to currrent node it it set to null - else if (temp->right == curr) - { - cout << curr->data << " "; - temp->right = NULL; - // current node is made to point its right subtree - curr = curr->right; - } - } - } -} - -int main() -{ - // Testing morrisInorder funtion - Btree *root = NULL; - int i; - for (i = 1; i <= 7; i++) - insert(&root, i); - cout << "Morris Inorder: "; - morrisInorder(root); - return 0; -} diff --git a/data_structure/Queue Using Array.cpp b/data_structure/Queue Using Array.cpp deleted file mode 100644 index 3b79d06fc..000000000 --- a/data_structure/Queue Using Array.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -using namespace std; - -int queue[10]; -int front = 0; -int rear = 0; - -void Enque(int x) -{ - if (rear == 10) - { - cout << "\nOverflow"; - } - else - { - queue[rear++] = x; - } -} - -void Deque() -{ - if (front == rear) - { - cout << "\nUnderflow"; - } - - else - { - cout << "\n" - << queue[front++] << " deleted"; - for (int i = front; i < rear; i++) - { - queue[i - front] = queue[i]; - } - rear = rear - front; - front = 0; - } -} - -void show() -{ - for (int i = front; i < rear; i++) - { - cout << queue[i] << "\t"; - } -} - -int main() -{ - int ch, x; - do - { - cout << "\n1. Enque"; - cout << "\n2. Deque"; - cout << "\n3. Print"; - cout << "\nEnter Your Choice : "; - cin >> ch; - if (ch == 1) - { - cout << "\nInsert : "; - cin >> x; - Enque(x); - } - else if (ch == 2) - { - Deque(); - } - else if (ch == 3) - { - show(); - } - } while (ch != 0); - - return 0; -} diff --git a/data_structure/Stack Using Array.cpp b/data_structure/Stack Using Array.cpp deleted file mode 100644 index af1d57c46..000000000 --- a/data_structure/Stack Using Array.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -using namespace std; - -int *stack; -int top = 0, size; - -void push(int x) -{ - if (top == size) - { - cout << "\nOverflow"; - } - else - { - stack[top++] = x; - } -} - -void pop() -{ - if (top == 0) - { - cout << "\nUnderflow"; - } - else - { - cout << "\n" - << stack[--top] << " deleted"; - } -} - -void show() -{ - for (int i = 0; i < top; i++) - { - cout << stack[i] << "\n"; - } -} - -void topmost() -{ - cout << "\nTopmost element: " << stack[top - 1]; -} -int main() -{ - cout << "\nEnter Size of stack : "; - cin >> size; - stack = new int[size]; - int ch, x; - do - { - cout << "\n1. Push"; - cout << "\n2. Pop"; - cout << "\n3. Print"; - cout << "\n4. Print topmost element:"; - cout << "\nEnter Your Choice : "; - cin >> ch; - if (ch == 1) - { - cout << "\nInsert : "; - cin >> x; - push(x); - } - else if (ch == 2) - { - pop(); - } - else if (ch == 3) - { - show(); - } - else if (ch == 4) - { - topmost(); - } - } while (ch != 0); - - return 0; -} diff --git a/data_structure/Stack Using Linked List.cpp b/data_structure/Stack Using Linked List.cpp deleted file mode 100644 index 6925cf10c..000000000 --- a/data_structure/Stack Using Linked List.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -using namespace std; - -struct node -{ - int val; - node *next; -}; - -node *top; - -void push(int x) -{ - node *n = new node; - n->val = x; - n->next = top; - top = n; -} - -void pop() -{ - if (top == NULL) - { - cout << "\nUnderflow"; - } - else - { - node *t = top; - cout << "\n" - << t->val << " deleted"; - top = top->next; - delete t; - } -} - -void show() -{ - node *t = top; - while (t != NULL) - { - cout << t->val << "\n"; - t = t->next; - } -} - -int main() -{ - int ch, x; - do - { - cout << "\n1. Push"; - cout << "\n2. Pop"; - cout << "\n3. Print"; - cout << "\nEnter Your Choice : "; - cin >> ch; - if (ch == 1) - { - cout << "\nInsert : "; - cin >> x; - push(x); - } - else if (ch == 2) - { - pop(); - } - else if (ch == 3) - { - show(); - } - } while (ch != 0); - - return 0; -} diff --git a/data_structure/avltree.cpp b/data_structure/avltree.cpp new file mode 100644 index 000000000..f38133c05 --- /dev/null +++ b/data_structure/avltree.cpp @@ -0,0 +1,151 @@ +#include +#include + +using namespace std; + +typedef struct node { + int data; + int height; + struct node *left; + struct node *right; +} node; + +int max(int a, int b) { return a > b ? a : b; } + +// Returns a new Node + +node *createNode(int data) { + node *nn = new node(); + nn->data = data; + nn->height = 0; + nn->left = NULL; + nn->right = NULL; + return nn; +} + +// Returns height of tree + +int height(node *root) { + if (root == NULL) + return 0; + return 1 + max(height(root->left), height(root->right)); +} + +// Returns difference between height of left and right subtree + +int getBalance(node *root) { return height(root->left) - height(root->right); } + +// Returns Node after Right Rotation + +node *rightRotate(node *root) { + node *t = root->left; + node *u = t->right; + t->right = root; + root->left = u; + return t; +} + +// Returns Node after Left Rotation + +node *leftRotate(node *root) { + node *t = root->right; + node *u = t->left; + t->left = root; + root->right = u; + return t; +} + +// Returns node with minimum value in the tree + +node *minValue(node *root) { + if (root->left == NULL) + return root; + return minValue(root->left); +} + +// Balanced Insertion + +node *insert(node *root, int item) { + node *nn = createNode(item); + if (root == NULL) + return nn; + if (item < root->data) + root->left = insert(root->left, item); + else + root->right = insert(root->right, item); + int b = getBalance(root); + if (b > 1) { + if (getBalance(root->left) < 0) + root->left = leftRotate(root->left); // Left-Right Case + return rightRotate(root); // Left-Left Case + } else if (b < -1) { + if (getBalance(root->right) > 0) + root->right = rightRotate(root->right); // Right-Left Case + return leftRotate(root); // Right-Right Case + } + return root; +} + +// Balanced Deletion + +node *deleteNode(node *root, int key) { + if (root == NULL) + return root; + if (key < root->data) + root->left = deleteNode(root->left, key); + else if (key > root->data) + root->right = deleteNode(root->right, key); + + else { + // Node to be deleted is leaf node or have only one Child + if (!root->right) { + node *temp = root->left; + delete (root); + root = NULL; + return temp; + } else if (!root->left) { + node *temp = root->right; + delete (root); + root = NULL; + return temp; + } + // Node to be deleted have both left and right subtrees + node *temp = minValue(root->right); + root->data = temp->data; + root->right = deleteNode(root->right, temp->data); + } + // Balancing Tree after deletion + return root; +} + +// LevelOrder (Breadth First Search) + +void levelOrder(node *root) { + queue q; + q.push(root); + while (!q.empty()) { + root = q.front(); + cout << root->data << " "; + q.pop(); + if (root->left) + q.push(root->left); + if (root->right) + q.push(root->right); + } +} + +int main() { + // Testing AVL Tree + node *root = NULL; + int i; + for (i = 1; i <= 7; i++) root = insert(root, i); + cout << "LevelOrder: "; + levelOrder(root); + root = deleteNode(root, 1); // Deleting key with value 1 + cout << "\nLevelOrder: "; + levelOrder(root); + root = deleteNode(root, 4); // Deletin key with value 4 + cout << "\nLevelOrder: "; + levelOrder(root); + return 0; +} diff --git a/data_structure/binary_search_tree.cpp b/data_structure/binary_search_tree.cpp new file mode 100644 index 000000000..c3a74f385 --- /dev/null +++ b/data_structure/binary_search_tree.cpp @@ -0,0 +1,165 @@ +#include +using namespace std; + +struct node { + int val; + node *left; + node *right; +}; + +struct queue { + node *t[100]; + int front; + int rear; +}; + +queue q; + +void enqueue(node *n) { q.t[q.rear++] = n; } + +node *dequeue() { return (q.t[q.front++]); } + +void Insert(node *n, int x) { + if (x < n->val) { + if (n->left == NULL) { + node *temp = new node; + temp->val = x; + temp->left = NULL; + temp->right = NULL; + n->left = temp; + } else { + Insert(n->left, x); + } + } else { + if (n->right == NULL) { + node *temp = new node; + temp->val = x; + temp->left = NULL; + temp->right = NULL; + n->left = temp; + } else { + Insert(n->right, x); + } + } +} + +int findMaxInLeftST(node *n) { + while (n->right != NULL) { + n = n->right; + } + return n->val; +} + +void Remove(node *p, node *n, int x) { + if (n->val == x) { + if (n->right == NULL && n->left == NULL) { + if (x < p->val) { + p->right = NULL; + } else { + p->left = NULL; + } + } else if (n->right == NULL) { + if (x < p->val) { + p->right = n->left; + } else { + p->left = n->left; + } + } else if (n->left == NULL) { + if (x < p->val) { + p->right = n->right; + } else { + p->left = n->right; + } + } else { + int y = findMaxInLeftST(n->left); + n->val = y; + Remove(n, n->right, y); + } + } else if (x < n->val) { + Remove(n, n->left, x); + } else { + Remove(n, n->right, x); + } +} + +void BFT(node *n) { + if (n != NULL) { + cout << n->val << " "; + enqueue(n->left); + enqueue(n->right); + BFT(dequeue()); + } +} + +void Pre(node *n) { + if (n != NULL) { + cout << n->val << " "; + Pre(n->left); + Pre(n->right); + } +} + +void In(node *n) { + if (n != NULL) { + In(n->left); + cout << n->val << " "; + In(n->right); + } +} + +void Post(node *n) { + if (n != NULL) { + Post(n->left); + Post(n->right); + cout << n->val << " "; + } +} + +int main() { + q.front = 0; + q.rear = 0; + int value; + int ch; + node *root = new node; + cout << "\nEnter the value of root node :"; + cin >> value; + root->val = value; + root->left = NULL; + root->right = NULL; + do { + cout << "\n1. Insert"; + cout << "\n2. Delete"; + cout << "\n3. Breadth First"; + cout << "\n4. Preorder Depth First"; + cout << "\n5. Inorder Depth First"; + cout << "\n6. Postorder Depth First"; + + cout << "\nEnter Your Choice : "; + cin >> ch; + int x; + switch (ch) { + case 1: + cout << "\nEnter the value to be Inserted : "; + cin >> x; + Insert(root, x); + break; + case 2: + cout << "\nEnter the value to be Deleted : "; + cin >> x; + Remove(root, root, x); + break; + case 3: + BFT(root); + break; + case 4: + Pre(root); + break; + case 5: + In(root); + break; + case 6: + Post(root); + break; + } + } while (ch != 0); +} diff --git a/data_structure/Binaryheap.cpp b/data_structure/binaryheap.cpp similarity index 82% rename from data_structure/Binaryheap.cpp rename to data_structure/binaryheap.cpp index 31129a823..a31d87674 100644 --- a/data_structure/Binaryheap.cpp +++ b/data_structure/binaryheap.cpp @@ -1,18 +1,17 @@ // A C++ program to demonstrate common Binary Heap Operations -#include #include +#include using namespace std; // Prototype of a utility function to swap two integers void swap(int *x, int *y); // A class for Min Heap -class MinHeap -{ - int *harr; // pointer to array of elements in heap - int capacity; // maximum possible size of min heap - int heap_size; // Current number of elements in min heap -public: +class MinHeap { + int *harr; // pointer to array of elements in heap + int capacity; // maximum possible size of min heap + int heap_size; // Current number of elements in min heap + public: // Constructor MinHeap(int capacity); @@ -44,18 +43,15 @@ public: }; // Constructor: Builds a heap from a given array a[] of given size -MinHeap::MinHeap(int cap) -{ +MinHeap::MinHeap(int cap) { heap_size = 0; capacity = cap; harr = new int[cap]; } // Inserts a new key 'k' -void MinHeap::insertKey(int k) -{ - if (heap_size == capacity) - { +void MinHeap::insertKey(int k) { + if (heap_size == capacity) { cout << "\nOverflow: Could not insertKey\n"; return; } @@ -66,8 +62,7 @@ void MinHeap::insertKey(int k) harr[i] = k; // Fix the min heap property if it is violated - while (i != 0 && harr[parent(i)] > harr[i]) - { + while (i != 0 && harr[parent(i)] > harr[i]) { swap(&harr[i], &harr[parent(i)]); i = parent(i); } @@ -75,23 +70,19 @@ void MinHeap::insertKey(int k) // Decreases value of key at index 'i' to new_val. It is assumed that // new_val is smaller than harr[i]. -void MinHeap::decreaseKey(int i, int new_val) -{ +void MinHeap::decreaseKey(int i, int new_val) { harr[i] = new_val; - while (i != 0 && harr[parent(i)] > harr[i]) - { + while (i != 0 && harr[parent(i)] > harr[i]) { swap(&harr[i], &harr[parent(i)]); i = parent(i); } } // Method to remove minimum element (or root) from min heap -int MinHeap::extractMin() -{ +int MinHeap::extractMin() { if (heap_size <= 0) return INT_MAX; - if (heap_size == 1) - { + if (heap_size == 1) { heap_size--; return harr[0]; } @@ -107,16 +98,14 @@ int MinHeap::extractMin() // This function deletes key at index i. It first reduced value to minus // infinite, then calls extractMin() -void MinHeap::deleteKey(int i) -{ +void MinHeap::deleteKey(int i) { decreaseKey(i, INT_MIN); extractMin(); } // A recursive method to heapify a subtree with the root at given index // This method assumes that the subtrees are already heapified -void MinHeap::MinHeapify(int i) -{ +void MinHeap::MinHeapify(int i) { int l = left(i); int r = right(i); int smallest = i; @@ -124,24 +113,21 @@ void MinHeap::MinHeapify(int i) smallest = l; if (r < heap_size && harr[r] < harr[smallest]) smallest = r; - if (smallest != i) - { + if (smallest != i) { swap(&harr[i], &harr[smallest]); MinHeapify(smallest); } } // A utility function to swap two elements -void swap(int *x, int *y) -{ +void swap(int *x, int *y) { int temp = *x; *x = *y; *y = temp; } // Driver program to test above functions -int main() -{ +int main() { MinHeap h(11); h.insertKey(3); h.insertKey(2); diff --git a/data_structure/circular_Queue_using_Linked_List.cpp b/data_structure/circular_queue_using_linked_list.cpp similarity index 78% rename from data_structure/circular_Queue_using_Linked_List.cpp rename to data_structure/circular_queue_using_linked_list.cpp index 4b1ec476c..b6a471044 100644 --- a/data_structure/circular_Queue_using_Linked_List.cpp +++ b/data_structure/circular_queue_using_linked_list.cpp @@ -1,24 +1,20 @@ #include using namespace std; -struct node -{ +struct node { int data; struct node *next; }; -class Queue -{ +class Queue { node *front; node *rear; -public: - Queue() - { + public: + Queue() { front = NULL; rear = NULL; } - void createNode(int val) - { + void createNode(int val) { node *ptr; node *nn; nn = new node; @@ -28,14 +24,10 @@ public: front = nn; rear = nn; } - void enqueue(int val) - { - if (front == NULL || rear == NULL) - { + void enqueue(int val) { + if (front == NULL || rear == NULL) { createNode(val); - } - else - { + } else { node *ptr; node *nn; ptr = front; @@ -46,19 +38,16 @@ public: rear = nn; } } - void dequeue() - { + void dequeue() { node *n; n = front; front = front->next; delete (n); } - void traverse() - { + void traverse() { node *ptr; ptr = front; - do - { + do { cout << ptr->data << " "; ptr = ptr->next; } while (ptr != rear->next); @@ -66,8 +55,7 @@ public: cout << endl; } }; -int main(void) -{ +int main(void) { Queue q; q.enqueue(10); q.enqueue(20); diff --git a/data_structure/cll/cll.cpp b/data_structure/cll/cll.cpp index efc068f3c..42bc9067e 100644 --- a/data_structure/cll/cll.cpp +++ b/data_structure/cll/cll.cpp @@ -5,49 +5,42 @@ using namespace std; /* Constructor */ -cll::cll() -{ +cll::cll() { head = NULL; total = 0; } -cll::~cll() -{ - /* Desstructure, no need to fill */ +cll::~cll() { /* Desstructure, no need to fill */ } /* Display a list. and total element */ -void cll::display() -{ +void cll::display() { if (head == NULL) cout << "List is empty !" << endl; - else - { + else { cout << "CLL list: "; node *current = head; - for (int i = 0; i < total; i++) - { + for (int i = 0; i < total; i++) { cout << current->data << " -> "; - current = current ->next; + current = current->next; } cout << head->data << endl; - cout << "Total element: "<< total <data = new_data; newNode->next = NULL; - if(head==NULL) { + if (head == NULL) { head = newNode; - head -> next = head; + head->next = head; } else { node *current = head; - while (current -> next != head) { + while (current->next != head) { current = current->next; } newNode->next = head; @@ -58,18 +51,17 @@ void cll::insert_front(int new_data) } /* List insert a new value at head in list */ -void cll::insert_tail(int new_data) -{ +void cll::insert_tail(int new_data) { node *newNode; newNode = new node; newNode->data = new_data; newNode->next = NULL; - if(head==NULL) { + if (head == NULL) { head = newNode; - head -> next = head; + head->next = head; } else { node *current = head; - while (current -> next != head) { + while (current->next != head) { current = current->next; } current->next = newNode; @@ -79,22 +71,17 @@ void cll::insert_tail(int new_data) } /* Get total element in list */ -int cll::get_size() -{ - return total; -} - +int cll::get_size() { return total; } /* Return true if the requested item (sent in as an argument) is in the list, otherwise return false */ -bool cll::find_item(int item_to_find) -{ +bool cll::find_item(int item_to_find) { if (head == NULL) { cout << "List is empty !" << endl; return false; } else { node *current = head; - while (current -> next != head) { + while (current->next != head) { if (current->data == item_to_find) return true; current = current->next; @@ -104,24 +91,20 @@ bool cll::find_item(int item_to_find) } /* Overloading method*/ -int cll::operator*() -{ - return head->data; -} +int cll::operator*() { return head->data; } /* Overload the pre-increment operator. The iterator is advanced to the next node. */ -void cll::operator++() -{ +void cll::operator++() { if (head == NULL) { cout << "List is empty !" << endl; } else { node *current = head; - while (current -> next != head) { - current = current -> next; + while (current->next != head) { + current = current->next; } - current->next = head -> next; - head = head -> next; + current->next = head->next; + head = head->next; } total--; } diff --git a/data_structure/cll/cll.h b/data_structure/cll/cll.h index ae71dcd01..a1a9b4d92 100644 --- a/data_structure/cll/cll.h +++ b/data_structure/cll/cll.h @@ -1,45 +1,43 @@ /* * Simple data structure CLL (Cicular Linear Linked List) * */ -#include #include -#include #include +#include +#include #ifndef CLL_H #define CLL_H /*The data structure is a linear linked list of integers */ -struct node -{ - int data; - node * next; +struct node { + int data; + node* next; }; -class cll -{ - public: - cll(); /* Construct without parameter */ - ~cll(); - void display(); /* Show the list */ +class cll { + public: + cll(); /* Construct without parameter */ + ~cll(); + void display(); /* Show the list */ - /****************************************************** - * Useful method for list - *******************************************************/ - void insert_front(int new_data); /* Insert a new value at head */ - void insert_tail(int new_data); /* Insert a new value at tail */ - int get_size(); /* Get total element in list */ - bool find_item(int item_to_find); /* Find an item in list */ + /****************************************************** + * Useful method for list + *******************************************************/ + void insert_front(int new_data); /* Insert a new value at head */ + void insert_tail(int new_data); /* Insert a new value at tail */ + int get_size(); /* Get total element in list */ + bool find_item(int item_to_find); /* Find an item in list */ - /****************************************************** - * Overloading method for list - *******************************************************/ - int operator*(); /* Returns the info contained in head */ - /* Overload the pre-increment operator. - The iterator is advanced to the next node. */ - void operator++(); + /****************************************************** + * Overloading method for list + *******************************************************/ + int operator*(); /* Returns the info contained in head */ + /* Overload the pre-increment operator. + The iterator is advanced to the next node. */ + void operator++(); - protected: - node * head; - int total; /* Total element in a list */ + protected: + node* head; + int total; /* Total element in a list */ }; #endif diff --git a/data_structure/cll/main_cll.cpp b/data_structure/cll/main_cll.cpp index 15388b822..0b6bfd3ed 100644 --- a/data_structure/cll/main_cll.cpp +++ b/data_structure/cll/main_cll.cpp @@ -1,44 +1,43 @@ #include "cll.h" using namespace std; -int main() -{ - /* Test CLL */ - cout << "----------- Test construct -----------" << endl; - cll list1; - list1.display(); - cout << "----------- Test insert front -----------" << endl; - list1.insert_front(5); - cout << "After insert 5 at front: "< root, rnk; void CreateSet(int n) { - root = vector (n+1); - rnk = vector (n+1, 1); - for (int i = 1; i <= n; ++i) { - root[i] = i; - } + root = vector(n + 1); + rnk = vector(n + 1, 1); + for (int i = 1; i <= n; ++i) { + root[i] = i; + } } int Find(int x) { - if (root[x] == x) { - return x; - } - return root[x] = Find(root[x]); + if (root[x] == x) { + return x; + } + return root[x] = Find(root[x]); } -bool InSameUnion(int x, int y) { - return Find(x) == Find(y); -} +bool InSameUnion(int x, int y) { return Find(x) == Find(y); } void Union(int x, int y) { - int a = Find(x), b = Find(y); - if (a != b) { - if (rnk[a] < rnk[b]) { - root[a] = b; - } else if (rnk[a] > rnk[b]) { - root[b] = a; - } else { - root[a] = b; - ++rnk[b]; + int a = Find(x), b = Find(y); + if (a != b) { + if (rnk[a] < rnk[b]) { + root[a] = b; + } else if (rnk[a] > rnk[b]) { + root[b] = a; + } else { + root[a] = b; + ++rnk[b]; + } } - } } int main() { - // tests CreateSet & Find - int n = 100; - CreateSet(n); - for (int i = 1; i <= 100; ++i) { - if (root[i] != i) { - cout << "Fail" << endl; - break; + // tests CreateSet & Find + int n = 100; + CreateSet(n); + for (int i = 1; i <= 100; ++i) { + if (root[i] != i) { + cout << "Fail" << endl; + break; + } } - } - // tests InSameUnion & Union - cout << "1 and 2 are initially not in the same subset" << endl; - if (InSameUnion(1, 2)) { - cout << "Fail" << endl; - } - Union(1, 2); - cout << "1 and 2 are now in the same subset" << endl; - if (!InSameUnion(1, 2)) { - cout << "Fail" << endl; - } - return 0; + // tests InSameUnion & Union + cout << "1 and 2 are initially not in the same subset" << endl; + if (InSameUnion(1, 2)) { + cout << "Fail" << endl; + } + Union(1, 2); + cout << "1 and 2 are now in the same subset" << endl; + if (!InSameUnion(1, 2)) { + cout << "Fail" << endl; + } + return 0; } diff --git a/data_structure/doubly_linked_list.cpp b/data_structure/doubly_linked_list.cpp index 17ea2983a..30cc257d8 100644 --- a/data_structure/doubly_linked_list.cpp +++ b/data_structure/doubly_linked_list.cpp @@ -1,137 +1,136 @@ +#include +#include #include -#include -#include struct node { - int val; - node *prev; - node *next; -}*start; + int val; + node *prev; + node *next; +} * start; class double_linked_list { public: - double_linked_list() { - start = NULL; - } - void insert(int x); - void remove(int x); - void search(int x); - void show(); - void reverseShow(); + double_linked_list() { start = NULL; } + void insert(int x); + void remove(int x); + void search(int x); + void show(); + void reverseShow(); }; void double_linked_list::insert(int x) { - node *t = start; - if (start != NULL) { - while (t->next != NULL) { - t = t->next; + node *t = start; + if (start != NULL) { + while (t->next != NULL) { + t = t->next; + } + node *n = new node; + t->next = n; + n->prev = t; + n->val = x; + n->next = NULL; + } else { + node *n = new node; + n->val = x; + n->prev = NULL; + n->next = NULL; + start = n; } - node *n = new node; - t->next = n; - n->prev = t; - n->val = x; - n->next = NULL; - } else { - node *n = new node; - n->val = x; - n->prev = NULL; - n->next = NULL; - start = n; - } } void double_linked_list::remove(int x) { - node *t = start; - while (t != NULL && t->val != x) { - t = t-> next; - } - if (t == NULL) { - return; - } - if (t->prev == NULL) { - if (t->next == NULL) { - start = NULL; - } else { - start = t->next; - start->prev = NULL; + node *t = start; + while (t != NULL && t->val != x) { + t = t->next; } - } else if (t->next == NULL) { - t->prev->next = NULL; - } else { - t->prev->next = t->next; - t->next->prev = t->prev; - } + if (t == NULL) { + return; + } + if (t->prev == NULL) { + if (t->next == NULL) { + start = NULL; + } else { + start = t->next; + start->prev = NULL; + } + } else if (t->next == NULL) { + t->prev->next = NULL; + } else { + t->prev->next = t->next; + t->next->prev = t->prev; + } + delete t; } void double_linked_list::search(int x) { - node *t = start; - int found = 0; - while (t != NULL) { - if (t->val == x) { - std::cout << "\nFound"; - found = 1; - break; + node *t = start; + int found = 0; + while (t != NULL) { + if (t->val == x) { + std::cout << "\nFound"; + found = 1; + break; + } + t = t->next; + } + if (found == 0) { + std::cout << "\nNot Found"; } - t = t->next; - } - if (found == 0) { - std::cout << "\nNot Found"; - } } void double_linked_list::show() { - node *t = start; - while (t != NULL) { - std::cout << t->val << "\t"; - t = t->next; - } + node *t = start; + while (t != NULL) { + std::cout << t->val << "\t"; + t = t->next; + } } void double_linked_list::reverseShow() { - node *t = start; - while (t != NULL && t->next != NULL) { - t = t->next; - } - while (t != NULL) { - std::cout << t->val << "\t"; - t = t->prev; - } + node *t = start; + while (t != NULL && t->next != NULL) { + t = t->next; + } + while (t != NULL) { + std::cout << t->val << "\t"; + t = t->prev; + } } int main() { - int choice, x; - double_linked_list ob; - do { - std::cout << "\n1. Insert"; - std::cout << "\n2. Delete"; - std::cout << "\n3. Search"; - std::cout << "\n4. Forward print"; - std::cout << "\n5. Reverse print"; - std::cout << "\n\nEnter you choice : "; - std::cin >> choice; - switch (choice) { - case 1: - std::cout << "\nEnter the element to be inserted : "; - std::cin >> x; - ob.insert(x); - break; - case 2: - std::cout << "\nEnter the element to be removed : "; - std::cin >> x; - ob.remove(x); - break; - case 3: - std::cout << "\nEnter the element to be searched : "; - std::cin >> x; - ob.search(x); - break; - case 4: - ob.show(); - break; - case 5: - ob.reverseShow(); - break; - } - } while (choice != 0); - return 0; + int choice, x; + double_linked_list ob; + do { + std::cout << "\n1. Insert"; + std::cout << "\n2. Delete"; + std::cout << "\n3. Search"; + std::cout << "\n4. Forward print"; + std::cout << "\n5. Reverse print"; + std::cout << "\n\nEnter you choice : "; + std::cin >> choice; + switch (choice) { + case 1: + std::cout << "\nEnter the element to be inserted : "; + std::cin >> x; + ob.insert(x); + break; + case 2: + std::cout << "\nEnter the element to be removed : "; + std::cin >> x; + ob.remove(x); + break; + case 3: + std::cout << "\nEnter the element to be searched : "; + std::cin >> x; + ob.search(x); + break; + case 4: + ob.show(); + break; + case 5: + ob.reverseShow(); + break; + } + } while (choice != 0); + return 0; } diff --git a/data_structure/linked_list.cpp b/data_structure/linked_list.cpp index 64cad14f9..8eb6e586d 100644 --- a/data_structure/linked_list.cpp +++ b/data_structure/linked_list.cpp @@ -1,135 +1,134 @@ #include struct node { - int val; - node *next; + int val; + node *next; }; node *start; void insert(int x) { - node *t = start; - node *n = new node; - n->val = x; - n->next = NULL; - if (start != NULL) { - while (t->next != NULL) { - t = t->next; - } - t->next = n; - } else { - start = n; + node *t = start; + node *n = new node; + n->val = x; + n->next = NULL; + if (start != NULL) { + while (t->next != NULL) { + t = t->next; } - + t->next = n; + } else { + start = n; + } } void remove(int x) { - if (start == NULL) { - std::cout << "\nLinked List is empty\n"; - return; - } else if (start->val == x) { - node *temp = start; - start = start->next; - delete temp; - return; - } - - node *temp = start, *parent = start; - - while (temp != NULL && temp->val != x) { - parent = temp; - temp = temp->next; - } - - if (temp == NULL) { - std::cout << std::endl << x << " not found in list\n"; - return; - } - - parent->next = temp->next; + if (start == NULL) { + std::cout << "\nLinked List is empty\n"; + return; + } else if (start->val == x) { + node *temp = start; + start = start->next; delete temp; + return; + } + + node *temp = start, *parent = start; + + while (temp != NULL && temp->val != x) { + parent = temp; + temp = temp->next; + } + + if (temp == NULL) { + std::cout << std::endl << x << " not found in list\n"; + return; + } + + parent->next = temp->next; + delete temp; } void search(int x) { - node *t = start; - int found = 0; - while (t != NULL) { - if (t->val == x) { - std::cout << "\nFound"; - found = 1; - break; - } - t = t->next; - } - if (found == 0) { - std::cout << "\nNot Found"; + node *t = start; + int found = 0; + while (t != NULL) { + if (t->val == x) { + std::cout << "\nFound"; + found = 1; + break; } + t = t->next; + } + if (found == 0) { + std::cout << "\nNot Found"; + } } void show() { - node *t = start; - while (t != NULL) { - std::cout << t->val << "\t"; - t = t->next; - } + node *t = start; + while (t != NULL) { + std::cout << t->val << "\t"; + t = t->next; + } } void reverse() { - node *first = start; - if (first != NULL) { - node *second = first->next; - while (second != NULL) { - node *tem = second->next; - second->next = first; - first = second; - second = tem; - } - start->next = NULL; - start = first; - } else { - std::cout << "\nEmpty list"; + node *first = start; + if (first != NULL) { + node *second = first->next; + while (second != NULL) { + node *tem = second->next; + second->next = first; + first = second; + second = tem; } + start->next = NULL; + start = first; + } else { + std::cout << "\nEmpty list"; + } } int main() { - int choice, x; - do { - std::cout << "\n1. Insert"; - std::cout << "\n2. Delete"; - std::cout << "\n3. Search"; - std::cout << "\n4. Print"; - std::cout << "\n5. Reverse"; - std::cout << "\n0. Exit"; - std::cout << "\n\nEnter you choice : "; - std::cin >> choice; - switch (choice) { - case 1: - std::cout << "\nEnter the element to be inserted : "; - std::cin >> x; - insert(x); - break; - case 2: - std::cout << "\nEnter the element to be removed : "; - std::cin >> x; - remove(x); - break; - case 3: - std::cout << "\nEnter the element to be searched : "; - std::cin >> x; - search(x); - break; - case 4: - show(); - std::cout << "\n"; - break; - case 5: - std::cout << "The reversed list: \n"; - reverse(); - show(); - std::cout << "\n"; - break; - } - } while (choice != 0); + int choice, x; + do { + std::cout << "\n1. Insert"; + std::cout << "\n2. Delete"; + std::cout << "\n3. Search"; + std::cout << "\n4. Print"; + std::cout << "\n5. Reverse"; + std::cout << "\n0. Exit"; + std::cout << "\n\nEnter you choice : "; + std::cin >> choice; + switch (choice) { + case 1: + std::cout << "\nEnter the element to be inserted : "; + std::cin >> x; + insert(x); + break; + case 2: + std::cout << "\nEnter the element to be removed : "; + std::cin >> x; + remove(x); + break; + case 3: + std::cout << "\nEnter the element to be searched : "; + std::cin >> x; + search(x); + break; + case 4: + show(); + std::cout << "\n"; + break; + case 5: + std::cout << "The reversed list: \n"; + reverse(); + show(); + std::cout << "\n"; + break; + } + } while (choice != 0); - return 0; + return 0; } diff --git a/data_structure/linkedList_implentation_usingArray.cpp b/data_structure/linkedlist_implentation_usingarray.cpp similarity index 62% rename from data_structure/linkedList_implentation_usingArray.cpp rename to data_structure/linkedlist_implentation_usingarray.cpp index 6f8205f27..a078bef16 100644 --- a/data_structure/linkedList_implentation_usingArray.cpp +++ b/data_structure/linkedlist_implentation_usingarray.cpp @@ -1,41 +1,45 @@ -/* The difference between the pointer implementation of linked list and array implementation of linked list: +/* The difference between the pointer implementation of linked list and array + implementation of linked list: 1. The NULL is represented by -1; - 2. Limited size. (in the following case it is 100 nodes at max). But we can reuse the nodes that are to be deleted by again linking it bacj to the list. + 2. Limited size. (in the following case it is 100 nodes at max). But we can + reuse the nodes that are to be deleted by again linking it bacj to the list. */ #include using namespace std; -struct Node -{ +struct Node { int data; int next; }; -Node AvailArray[100]; //array that will act as nodes of a linked list. +Node AvailArray[100]; // array that will act as nodes of a linked list. int head = -1; int avail = 0; -void initialise_list() -{ - for (int i = 0; i <= 98; i++) - { +void initialise_list() { + for (int i = 0; i <= 98; i++) { AvailArray[i].next = i + 1; } - AvailArray[99].next = -1; //indicating the end of the linked list. + AvailArray[99].next = -1; // indicating the end of the linked list. } -int getnode() //This will return the index of the first free node present in the avail list +int getnode() // This will return the index of the first free node present in + // the avail list { int NodeIndexToBeReturned = avail; avail = AvailArray[avail].next; return NodeIndexToBeReturned; } -void freeNode(int nodeToBeDeleted) //This function when called will delete the node with the index presented as an argument, and will put back that node into the array. +void freeNode( + int nodeToBeDeleted) // This function when called will delete the node with + // the index presented as an argument, and will put + // back that node into the array. { AvailArray[nodeToBeDeleted].next = avail; avail = nodeToBeDeleted; } -void insertAtTheBeginning(int data) //The function will insert the given data into the front of the linked list. +void insertAtTheBeginning(int data) // The function will insert the given data + // into the front of the linked list. { int newNode = getnode(); AvailArray[newNode].data = data; @@ -43,25 +47,21 @@ void insertAtTheBeginning(int data) //The function will insert the given data in head = newNode; } -void insertAtTheEnd(int data) -{ +void insertAtTheEnd(int data) { int newNode = getnode(); int temp = head; - while (AvailArray[temp].next != -1) - { + while (AvailArray[temp].next != -1) { temp = AvailArray[temp].next; } - //temp is now pointing to the end node. + // temp is now pointing to the end node. AvailArray[newNode].data = data; AvailArray[newNode].next = -1; AvailArray[temp].next = newNode; } -void display() -{ +void display() { int temp = head; - while (temp != -1) - { + while (temp != -1) { cout << AvailArray[temp].data << "->"; temp = AvailArray[temp].next; } @@ -69,20 +69,17 @@ void display() ; } -int main() -{ +int main() { initialise_list(); int x, y, z; - for (;;) - { + for (;;) { cout << "1. Insert At The Beginning" << endl; cout << "2. Insert At The End" << endl; cout << "3. Display" << endl; cout << "4.Exit" << endl; cout << "Enter Your choice" << endl; cin >> z; - switch (z) - { + switch (z) { case 1: cout << "Enter the number you want to enter" << endl; cin >> x; @@ -94,7 +91,8 @@ int main() insertAtTheEnd(y); break; case 3: - cout << "The linked list contains the following element in order" << endl; + cout << "The linked list contains the following element in order" + << endl; display(); break; case 4: diff --git a/data_structure/list_array.cpp b/data_structure/list_array.cpp new file mode 100644 index 000000000..c796ffef9 --- /dev/null +++ b/data_structure/list_array.cpp @@ -0,0 +1,153 @@ +#include +using namespace std; + +struct list { + int data[50]; + int top = 0; + bool isSorted = false; + + int BinarySearch(int *array, int first, int last, int x) { + if (last < first) { + return -1; + } + int mid = (first + last) / 2; + if (array[mid] == x) + return mid; + else if (x < array[mid]) + return (BinarySearch(array, first, mid - 1, x)); + else if (x > array[mid]) + return (BinarySearch(array, mid + 1, last, x)); + } + + int LinarSearch(int *array, int x) { + for (int i = 0; i < top; i++) { + if (array[i] == x) { + return i; + } + } + + return -1; + } + + int Search(int x) { + int pos = -1; + + if (isSorted) { + pos = BinarySearch(data, 0, top - 1, x); + } + + else { + pos = LinarSearch(data, x); + } + + if (pos != -1) { + cout << "\nElement found at position : " << pos; + } else { + cout << "\nElement not found"; + } + return pos; + } + + void Sort() { + int i, j, pos; + for (i = 0; i < top; i++) { + int min = data[i]; + for (j = i + 1; j < top; j++) { + if (data[j] < min) { + pos = j; + min = data[pos]; + } + } + + int temp = data[i]; + data[i] = data[pos]; + data[pos] = temp; + } + isSorted = true; + } + + void insert(int x) { + if (!isSorted) { + if (top == 49) { + cout << "\nOverflow"; + } else { + data[top] = x; + top++; + } + } + + else { + int pos = 0; + + for (int i = 0; i < top - 1; i++) { + if (data[i] <= x && x <= data[i + 1]) { + pos = i + 1; + break; + } + } + if (pos == 0) { + pos = top - 1; + } + + for (int i = top; i > pos; i--) { + data[i] = data[i - 1]; + } + top++; + data[pos] = x; + } + } + + void Remove(int x) { + int pos = Search(x); + cout << "\n" << data[pos] << " deleted"; + for (int i = pos; i < top; i++) { + data[i] = data[i + 1]; + } + top--; + } + + void Show() { + for (int i = 0; i < top; i++) { + cout << data[i] << "\t"; + } + } +}; + +int main() { + list L; + int choice; + int x; + do { + cout << "\n1.Insert"; + cout << "\n2.Delete"; + cout << "\n3.Search"; + cout << "\n4.Sort"; + cout << "\n5.Print"; + cout << "\n\nEnter Your Choice : "; + cin >> choice; + switch (choice) { + case 1: + cout << "\nEnter the element to be inserted : "; + cin >> x; + L.insert(x); + break; + case 2: + cout << "\nEnter the element to be removed : "; + cin >> x; + L.Remove(x); + break; + case 3: + cout << "\nEnter the element to be searched : "; + cin >> x; + L.Search(x); + break; + case 4: + L.Sort(); + break; + case 5: + L.Show(); + break; + } + } while (choice != 0); + return 0; +} diff --git a/data_structure/morrisinorder.cpp b/data_structure/morrisinorder.cpp new file mode 100644 index 000000000..f1f9e068c --- /dev/null +++ b/data_structure/morrisinorder.cpp @@ -0,0 +1,92 @@ +#include +#include + +/************************** + @author shrutisheoran +**************************/ + +using namespace std; + +struct Btree { + int data; + struct Btree *left; // Pointer to left subtree + struct Btree *right; // Pointer to right subtree +}; + +void insert(Btree **root, int d) { + Btree *nn = new Btree(); // Creating new node + nn->data = d; + nn->left = NULL; + nn->right = NULL; + if (*root == NULL) { + *root = nn; + return; + } else { + queue q; + // Adding root node to queue + q.push(*root); + while (!q.empty()) { + Btree *node = q.front(); + // Removing parent node from queue + q.pop(); + if (node->left) + // Adding left child of removed node to queue + q.push(node->left); + else { + // Adding new node if no left child is present + node->left = nn; + return; + } + if (node->right) + // Adding right child of removed node to queue + q.push(node->right); + else { + // Adding new node if no right child is present + node->right = nn; + return; + } + } + } +} + +void morrisInorder(Btree *root) { + Btree *curr = root; + Btree *temp; + while (curr) { + if (curr->left == NULL) { + cout << curr->data << " "; + // If left of current node is NULL then curr is shifted to right + curr = curr->right; + } else { + // Left of current node is stored in temp + temp = curr->left; + // Moving to extreme right of temp + while (temp->right && temp->right != curr) temp = temp->right; + // If extreme right is null it is made to point to currrent node + // (will be used for backtracking) + if (temp->right == NULL) { + temp->right = curr; + // current node is made to point its left subtree + curr = curr->left; + } + // If extreme right already points to currrent node it it set to + // null + else if (temp->right == curr) { + cout << curr->data << " "; + temp->right = NULL; + // current node is made to point its right subtree + curr = curr->right; + } + } + } +} + +int main() { + // Testing morrisInorder funtion + Btree *root = NULL; + int i; + for (i = 1; i <= 7; i++) insert(&root, i); + cout << "Morris Inorder: "; + morrisInorder(root); + return 0; +} diff --git a/data_structure/queue/queue.cpp b/data_structure/queue/queue.cpp index 728adfc18..a7055bb14 100644 --- a/data_structure/queue/queue.cpp +++ b/data_structure/queue/queue.cpp @@ -1,13 +1,12 @@ -#include -#include #include "queue.h" +#include +#include using namespace std; /* Default constructor*/ template -queue::queue() -{ +queue::queue() { queueFront = NULL; queueRear = NULL; size = 0; @@ -15,42 +14,36 @@ queue::queue() /* Destructor */ template -queue::~queue() -{ -} +queue::~queue() {} /* Display for testing */ template -void queue::display() -{ +void queue::display() { node *current = queueFront; cout << "Front --> "; - while(current != NULL) { - cout<data<< " "; - current = current -> next; + while (current != NULL) { + cout << current->data << " "; + current = current->next; } - cout < -bool queue::isEmptyQueue() -{ +bool queue::isEmptyQueue() { return (queueFront == NULL); } /* Clear queue */ template -void queue::clear() -{ +void queue::clear() { queueFront = NULL; } /* Add new item to the queue */ template -void queue::enQueue(Kind item) -{ +void queue::enQueue(Kind item) { node *newNode; newNode = new node; newNode->data = item; @@ -67,18 +60,16 @@ void queue::enQueue(Kind item) /* Return the top element of the queue */ template -Kind queue::front() -{ +Kind queue::front() { assert(queueFront != NULL); return queueFront->data; } /* Remove the element of the queue */ template -void queue::deQueue() -{ +void queue::deQueue() { node *temp; - if(!isEmptyQueue()) { + if (!isEmptyQueue()) { temp = queueFront; queueFront = queueFront->next; delete temp; @@ -87,4 +78,3 @@ void queue::deQueue() cout << "Queue is empty !" << endl; } } - diff --git a/data_structure/queue/queue.h b/data_structure/queue/queue.h index 715def1ef..d1305fc81 100644 --- a/data_structure/queue/queue.h +++ b/data_structure/queue/queue.h @@ -4,31 +4,28 @@ /* Definition of the node */ template -struct node -{ +struct node { Kind data; node *next; }; /* Definition of the queue class */ template -class queue -{ - public: - void display(); /* Show queue */ - queue(); /* Default constructor*/ - ~queue(); /* Destructor */ - bool isEmptyQueue(); /* Determine whether the queue is empty */ - void enQueue (Kind item); /* Add new item to the queue */ - Kind front(); /* Return the first element of the queue */ - void deQueue(); /* Remove the top element of the queue */ - void clear(); +class queue { + public: + void display(); /* Show queue */ + queue(); /* Default constructor*/ + ~queue(); /* Destructor */ + bool isEmptyQueue(); /* Determine whether the queue is empty */ + void enQueue(Kind item); /* Add new item to the queue */ + Kind front(); /* Return the first element of the queue */ + void deQueue(); /* Remove the top element of the queue */ + void clear(); - private: - node *queueFront; /* Pointer to the front of the queue */ - node *queueRear; /* Pointer to the rear of the queue */ - int size; + private: + node *queueFront; /* Pointer to the front of the queue */ + node *queueRear; /* Pointer to the rear of the queue */ + int size; }; #endif - diff --git a/data_structure/queue/test_queue.cpp b/data_structure/queue/test_queue.cpp index caf80318c..7f0923f78 100644 --- a/data_structure/queue/test_queue.cpp +++ b/data_structure/queue/test_queue.cpp @@ -1,22 +1,24 @@ #include #include -#include "queue.h" #include "queue.cpp" +#include "queue.h" using namespace std; -int main() -{ +int main() { queue q; - cout << "---------------------- Test construct ----------------------" << endl; + cout << "---------------------- Test construct ----------------------" + << endl; q.display(); - cout << "---------------------- Test isEmptyQueue ----------------------" << endl; - if(q.isEmptyQueue()) - cout << "PASS" < +using namespace std; + +int queue[10]; +int front = 0; +int rear = 0; + +void Enque(int x) { + if (rear == 10) { + cout << "\nOverflow"; + } else { + queue[rear++] = x; + } +} + +void Deque() { + if (front == rear) { + cout << "\nUnderflow"; + } + + else { + cout << "\n" << queue[front++] << " deleted"; + for (int i = front; i < rear; i++) { + queue[i - front] = queue[i]; + } + rear = rear - front; + front = 0; + } +} + +void show() { + for (int i = front; i < rear; i++) { + cout << queue[i] << "\t"; + } +} + +int main() { + int ch, x; + do { + cout << "\n1. Enque"; + cout << "\n2. Deque"; + cout << "\n3. Print"; + cout << "\nEnter Your Choice : "; + cin >> ch; + if (ch == 1) { + cout << "\nInsert : "; + cin >> x; + Enque(x); + } else if (ch == 2) { + Deque(); + } else if (ch == 3) { + show(); + } + } while (ch != 0); + + return 0; +} diff --git a/data_structure/Queue Using Linked List.cpp b/data_structure/queue_using_linked_list.cpp similarity index 69% rename from data_structure/Queue Using Linked List.cpp rename to data_structure/queue_using_linked_list.cpp index 39d7a9ae3..7b44d240c 100644 --- a/data_structure/Queue Using Linked List.cpp +++ b/data_structure/queue_using_linked_list.cpp @@ -1,18 +1,15 @@ #include using namespace std; -struct node -{ +struct node { int val; node *next; }; node *front, *rear; -void Enque(int x) -{ - if (rear == NULL) - { +void Enque(int x) { + if (rear == NULL) { node *n = new node; n->val = x; n->next = NULL; @@ -20,9 +17,7 @@ void Enque(int x) front = n; } - else - { - + else { node *n = new node; n->val = x; n->next = NULL; @@ -31,17 +26,12 @@ void Enque(int x) } } -void Deque() -{ - if (rear == NULL && front == NULL) - { +void Deque() { + if (rear == NULL && front == NULL) { cout << "\nUnderflow"; - } - else - { + } else { node *t = front; - cout << "\n" - << t->val << " deleted"; + cout << "\n" << t->val << " deleted"; front = front->next; delete t; if (front == NULL) @@ -49,38 +39,29 @@ void Deque() } } -void show() -{ +void show() { node *t = front; - while (t != NULL) - { + while (t != NULL) { cout << t->val << "\t"; t = t->next; } } -int main() -{ +int main() { int ch, x; - do - { + do { cout << "\n1. Enque"; cout << "\n2. Deque"; cout << "\n3. Print"; cout << "\nEnter Your Choice : "; cin >> ch; - if (ch == 1) - { + if (ch == 1) { cout << "\nInsert : "; cin >> x; Enque(x); - } - else if (ch == 2) - { + } else if (ch == 2) { Deque(); - } - else if (ch == 3) - { + } else if (ch == 3) { show(); } } while (ch != 0); diff --git a/data_structure/queue_using_linkedlist.cpp b/data_structure/queue_using_linkedlist.cpp index 8bc130c27..f1bf18123 100644 --- a/data_structure/queue_using_linkedlist.cpp +++ b/data_structure/queue_using_linkedlist.cpp @@ -1,98 +1,86 @@ /* Write a program to implement Queue using linkedlist. */ -#include - - -struct linkedlist{ - int data; - linkedlist *next; +#include +struct linkedlist { + int data; + linkedlist *next; }; -class stack_linkedList{ - public: +class stack_linkedList { + public: linkedlist *front; linkedlist *rear; - - stack_linkedList(){ - front=rear=NULL; - } + + stack_linkedList() { front = rear = NULL; } void enqueue(int); int dequeue(); void display(); - }; -void stack_linkedList::enqueue(int ele){ - - linkedlist *temp=new linkedlist(); - temp->data=ele; - temp->next=NULL; +void stack_linkedList::enqueue(int ele) { + linkedlist *temp = new linkedlist(); + temp->data = ele; + temp->next = NULL; - if(front==NULL) - front=rear=temp; - else{ - rear->next=temp; - rear=temp; + if (front == NULL) + front = rear = temp; + else { + rear->next = temp; + rear = temp; } } -int stack_linkedList::dequeue(){ +int stack_linkedList::dequeue() { linkedlist *temp; int ele; - if(front==NULL) - std::cout<<"\nStack is empty"; - else{ - temp=front; - ele=temp->data; - if(front==rear) //if length of queue is 1; - rear=rear->next; - front=front->next; - delete(temp); + if (front == NULL) + std::cout << "\nStack is empty"; + else { + temp = front; + ele = temp->data; + if (front == rear) // if length of queue is 1; + rear = rear->next; + front = front->next; + delete (temp); } return ele; } -void stack_linkedList::display(){ - - if(front==NULL) - std::cout<<"\nStack is empty"; - +void stack_linkedList::display() { + if (front == NULL) + std::cout << "\nStack is empty"; + else { - linkedlist *temp; - temp=front; - while(temp!=NULL){ - std::cout<data<<" "; - temp=temp->next; + temp = front; + while (temp != NULL) { + std::cout << temp->data << " "; + temp = temp->next; } } } -int main(){ - - int op,data; +int main() { + int op, data; stack_linkedList ob; - std::cout<<"\n1. enqueue(Insertion) "; - std::cout<<"\n2. dequeue(Deletion)"; - std::cout<<"\n3. Display"; - std::cout<<"\n4. Exit"; - - while(1){ - std::cout<<"\nEnter your choice "; - std::cin>>op; - if(op==1) - { - std::cout<<"Enter data "; - std::cin>>data; + std::cout << "\n1. enqueue(Insertion) "; + std::cout << "\n2. dequeue(Deletion)"; + std::cout << "\n3. Display"; + std::cout << "\n4. Exit"; + + while (1) { + std::cout << "\nEnter your choice "; + std::cin >> op; + if (op == 1) { + std::cout << "Enter data "; + std::cin >> data; ob.enqueue(data); - } - else if(op==2) - data=ob.dequeue(); - else if(op==3) + } else if (op == 2) + data = ob.dequeue(); + else if (op == 3) ob.display(); - else if(op==4) + else if (op == 4) exit(0); else - std::cout<<"\nWrong choice "; - + std::cout << "\nWrong choice "; } return 0; } diff --git a/data_structure/stack_using_array.cpp b/data_structure/stack_using_array.cpp new file mode 100644 index 000000000..5dd7ac98e --- /dev/null +++ b/data_structure/stack_using_array.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; + +int *stack; +int top = 0, size; + +void push(int x) { + if (top == size) { + cout << "\nOverflow"; + } else { + stack[top++] = x; + } +} + +void pop() { + if (top == 0) { + cout << "\nUnderflow"; + } else { + cout << "\n" << stack[--top] << " deleted"; + } +} + +void show() { + for (int i = 0; i < top; i++) { + cout << stack[i] << "\n"; + } +} + +void topmost() { cout << "\nTopmost element: " << stack[top - 1]; } +int main() { + cout << "\nEnter Size of stack : "; + cin >> size; + stack = new int[size]; + int ch, x; + do { + cout << "\n1. Push"; + cout << "\n2. Pop"; + cout << "\n3. Print"; + cout << "\n4. Print topmost element:"; + cout << "\nEnter Your Choice : "; + cin >> ch; + if (ch == 1) { + cout << "\nInsert : "; + cin >> x; + push(x); + } else if (ch == 2) { + pop(); + } else if (ch == 3) { + show(); + } else if (ch == 4) { + topmost(); + } + } while (ch != 0); + + return 0; +} diff --git a/data_structure/stack_using_linked_list.cpp b/data_structure/stack_using_linked_list.cpp new file mode 100644 index 000000000..ae53fe95a --- /dev/null +++ b/data_structure/stack_using_linked_list.cpp @@ -0,0 +1,57 @@ +#include +using namespace std; + +struct node { + int val; + node *next; +}; + +node *top; + +void push(int x) { + node *n = new node; + n->val = x; + n->next = top; + top = n; +} + +void pop() { + if (top == NULL) { + cout << "\nUnderflow"; + } else { + node *t = top; + cout << "\n" << t->val << " deleted"; + top = top->next; + delete t; + } +} + +void show() { + node *t = top; + while (t != NULL) { + cout << t->val << "\n"; + t = t->next; + } +} + +int main() { + int ch, x; + do { + cout << "\n1. Push"; + cout << "\n2. Pop"; + cout << "\n3. Print"; + cout << "\nEnter Your Choice : "; + cin >> ch; + if (ch == 1) { + cout << "\nInsert : "; + cin >> x; + push(x); + } else if (ch == 2) { + pop(); + } else if (ch == 3) { + show(); + } + } while (ch != 0); + + return 0; +} diff --git a/data_structure/stk/main.cpp b/data_structure/stk/main.cpp index 2d6bbec56..44b7984e0 100644 --- a/data_structure/stk/main.cpp +++ b/data_structure/stk/main.cpp @@ -8,18 +8,18 @@ * ./main student.txt ************************************************************ * */ -#include -#include -#include -#include #include +#include +#include +#include +#include -#include "stack.h" #include "stack.cpp" +#include "stack.h" using namespace std; -int main(int argc, char * argv[]) { +int main(int argc, char* argv[]) { double GPA; double highestGPA; string name; @@ -44,7 +44,7 @@ int main(int argc, char * argv[]) { } infile >> GPA >> name; } - cout << "Highest GPA: " << highestGPA < -#include #include "stack.h" +#include +#include using namespace std; /* Default constructor*/ template -stack::stack() -{ +stack::stack() { stackTop = NULL; size = 0; } /* Destructor */ template -stack::~stack() -{ -} +stack::~stack() {} /* Display for testing */ template -void stack::display() -{ +void stack::display() { node *current = stackTop; cout << "Top --> "; - while(current != NULL) { - cout<data<< " "; - current = current -> next; + while (current != NULL) { + cout << current->data << " "; + current = current->next; } - cout < -bool stack::isEmptyStack() -{ +bool stack::isEmptyStack() { return (stackTop == NULL); } /* Clear stack */ template -void stack::clear() -{ +void stack::clear() { stackTop = NULL; } /* Add new item to the stack */ template -void stack::push(Type item) -{ +void stack::push(Type item) { node *newNode; newNode = new node; newNode->data = item; @@ -60,18 +53,16 @@ void stack::push(Type item) /* Return the top element of the stack */ template -Type stack::top() -{ +Type stack::top() { assert(stackTop != NULL); return stackTop->data; } /* Remove the top element of the stack */ template -void stack::pop() -{ +void stack::pop() { node *temp; - if(!isEmptyStack()) { + if (!isEmptyStack()) { temp = stackTop; stackTop = stackTop->next; delete temp; @@ -83,8 +74,7 @@ void stack::pop() /* Operator "=" */ template -stack stack::operator=(stack & otherStack) -{ +stack stack::operator=(stack &otherStack) { node *newNode, *current, *last; if (stackTop != NULL) /* If stack is no empty, make it empty */ @@ -97,10 +87,9 @@ stack stack::operator=(stack & otherStack) stackTop->data = current->data; stackTop->next = NULL; last = stackTop; - current = current ->next; + current = current->next; /* Copy the remaining stack */ - while (current != NULL) - { + while (current != NULL) { newNode = new node; newNode->data = current->data; newNode->next = NULL; diff --git a/data_structure/stk/stack.h b/data_structure/stk/stack.h index a93669482..da7788b73 100644 --- a/data_structure/stk/stack.h +++ b/data_structure/stk/stack.h @@ -4,32 +4,29 @@ /* Definition of the node */ template -struct node -{ +struct node { Type data; node *next; }; /* Definition of the stack class */ template -class stack -{ - public: - void display(); /* Show stack */ - stack(); /* Default constructor*/ - ~stack(); /* Destructor */ - bool isEmptyStack(); /* Determine whether the stack is empty */ - void push (Type item); /* Add new item to the stack */ - Type top(); /* Return the top element of the stack */ - void pop(); /* Remove the top element of the stack */ - void clear(); +class stack { + public: + void display(); /* Show stack */ + stack(); /* Default constructor*/ + ~stack(); /* Destructor */ + bool isEmptyStack(); /* Determine whether the stack is empty */ + void push(Type item); /* Add new item to the stack */ + Type top(); /* Return the top element of the stack */ + void pop(); /* Remove the top element of the stack */ + void clear(); - stack operator=(stack & otherStack); - // Overload "=" the assignment operator. - private: - node *stackTop; /* Pointer to the stack */ - int size; + stack operator=(stack &otherStack); + // Overload "=" the assignment operator. + private: + node *stackTop; /* Pointer to the stack */ + int size; }; #endif - diff --git a/data_structure/stk/test_stack.cpp b/data_structure/stk/test_stack.cpp index 4703fc906..098027dfd 100644 --- a/data_structure/stk/test_stack.cpp +++ b/data_structure/stk/test_stack.cpp @@ -1,21 +1,22 @@ #include -#include "stack.h" #include "stack.cpp" +#include "stack.h" using namespace std; -int main() -{ +int main() { stack stk; - cout << "---------------------- Test construct ----------------------" << endl; + cout << "---------------------- Test construct ----------------------" + << endl; stk.display(); - cout << "---------------------- Test isEmptyStack ----------------------" << endl; - if(stk.isEmptyStack()) - cout << "PASS" < stk1; - cout << "stk current: "<< endl; + cout << "stk current: " << endl; stk.display(); - cout << endl << "Assign stk1 = stk "<< endl; + cout << endl << "Assign stk1 = stk " << endl; stk1 = stk; stk1.display(); - cout << endl<< "After pushing 8 9 10 into stk1:" < using namespace std; -struct node -{ +struct node { int val; node *left; node *right; }; -void CreateTree(node *curr, node *n, int x, char pos) -{ - if (n != NULL) - { +void CreateTree(node *curr, node *n, int x, char pos) { + if (n != NULL) { char ch; - cout << "\nLeft or Right of " << n->val << " : "; - cin >> ch; - if (ch == 'l') - CreateTree(n, n->left, x, ch); - else if (ch == 'r') - CreateTree(n, n->right, x, ch); - } - else - { + cout << "\nLeft or Right of " << n->val << " : "; + cin >> ch; + if (ch == 'l') + CreateTree(n, n->left, x, ch); + else if (ch == 'r') + CreateTree(n, n->right, x, ch); + } else { node *t = new node; t->val = x; t->left = NULL; t->right = NULL; - if (pos == 'l') - { + if (pos == 'l') { curr->left = t; - } - else if (pos == 'r') - { + } else if (pos == 'r') { curr->right = t; } } } -void BFT(node *n) -{ - list queue; +void BFT(node *n) { + list queue; queue.push_back(n); - while(!queue.empty()) - { + while (!queue.empty()) { n = queue.front(); cout << n->val << " "; queue.pop_front(); - if(n->left != NULL) + if (n->left != NULL) queue.push_back(n->left); - if(n->right != NULL) + if (n->right != NULL) queue.push_back(n->right); } } -void Pre(node *n) -{ - if (n != NULL) - { +void Pre(node *n) { + if (n != NULL) { cout << n->val << " "; Pre(n->left); Pre(n->right); } } -void In(node *n) -{ - if (n != NULL) - { +void In(node *n) { + if (n != NULL) { In(n->left); cout << n->val << " "; In(n->right); } } -void Post(node *n) -{ - if (n != NULL) - { +void Post(node *n) { + if (n != NULL) { Post(n->left); Post(n->right); cout << n->val << " "; } } -int main() -{ +int main() { int value; int ch; node *root = new node; @@ -97,8 +80,7 @@ int main() root->val = value; root->left = NULL; root->right = NULL; - do - { + do { cout << "\n1. Insert"; cout << "\n2. Breadth First"; cout << "\n3. Preorder Depth First"; @@ -107,8 +89,7 @@ int main() cout << "\nEnter Your Choice : "; cin >> ch; - switch (ch) - { + switch (ch) { case 1: int x; char pos; diff --git a/data_structure/trie_tree.cpp b/data_structure/trie_tree.cpp index 2b84099e8..66b67fbc0 100644 --- a/data_structure/trie_tree.cpp +++ b/data_structure/trie_tree.cpp @@ -1,78 +1,75 @@ -#include #include +#include #include #include // structure definition typedef struct trie { - struct trie * arr[26]; + struct trie* arr[26]; bool isEndofWord; } trie; // create a new node for trie -trie * createNode() { - trie * nn = new trie(); - for (int i = 0; i < 26; i++) - nn -> arr[i] = NULL; - nn -> isEndofWord = false; +trie* createNode() { + trie* nn = new trie(); + for (int i = 0; i < 26; i++) nn->arr[i] = NULL; + nn->isEndofWord = false; return nn; } // insert string into the trie -void insert(trie * root, std::string str) { +void insert(trie* root, std::string str) { for (int i = 0; i < str.length(); i++) { int j = str[i] - 'a'; - if (root -> arr[j]) { - root = root -> arr[j]; + if (root->arr[j]) { + root = root->arr[j]; } else { - root -> arr[j] = createNode(); - root = root -> arr[j]; + root->arr[j] = createNode(); + root = root->arr[j]; } } - root -> isEndofWord = true; + root->isEndofWord = true; } // search a string exists inside the trie -bool search(trie * root, std::string str, int index) { +bool search(trie* root, std::string str, int index) { if (index == str.length()) { - if (!root -> isEndofWord) + if (!root->isEndofWord) return false; return true; } int j = str[index] - 'a'; - if (!root -> arr[j]) + if (!root->arr[j]) return false; - return search(root -> arr[j], str, index + 1); + return search(root->arr[j], str, index + 1); } /* -removes the string if it is not a prefix of any other -string, if it is then just sets the endofword to false, else +removes the string if it is not a prefix of any other +string, if it is then just sets the endofword to false, else removes the given string */ -bool deleteString(trie * root, std::string str, int index) { +bool deleteString(trie* root, std::string str, int index) { if (index == str.length()) { - if (!root -> isEndofWord) - return false; - root -> isEndofWord = false; - for (int i = 0; i < 26; i++) + if (!root->isEndofWord) return false; + root->isEndofWord = false; + for (int i = 0; i < 26; i++) return false; return true; } int j = str[index] - 'a'; - if (!root -> arr[j]) + if (!root->arr[j]) return false; - bool - var = deleteString(root, str, index + 1); + bool var = deleteString(root, str, index + 1); if (var) { - root -> arr[j] = NULL; - if (root -> isEndofWord) { + root->arr[j] = NULL; + if (root->isEndofWord) { return false; } else { int i; for (i = 0; i < 26; i++) - if (root -> arr[i]) + if (root->arr[i]) return false; return true; } @@ -80,7 +77,7 @@ bool deleteString(trie * root, std::string str, int index) { } int main() { - trie * root = createNode(); + trie* root = createNode(); insert(root, "hello"); insert(root, "world"); int a = search(root, "hello", 0); diff --git a/doc/cppreference-doxygen-web.tag.xml b/doc/cppreference-doxygen-web.tag.xml new file mode 100644 index 000000000..ea8388b8b --- /dev/null +++ b/doc/cppreference-doxygen-web.tag.xml @@ -0,0 +1,35489 @@ + + + + std + + std::is_function + + T + atomic_fetch_and_explicit + cpp/atomic/atomic_fetch_sub + + (T... args) + + + T + atomic_fetch_xor_explicit + cpp/atomic/atomic_fetch_xor + + (T... args) + + + T + set_unexpected + cpp/error/set_unexpected + + (T... args) + + std::input_iterator_tag + std::logical_and + std::is_integral + std::money_get + + T + fputs + cpp/io/c/fputs + + (T... args) + + std::basic_ofstream + std::ratio_subtract + + T + modf + cpp/numeric/math/modf + + (T... args) + + std::size_t + + T + not2 + cpp/utility/functional/not2 + + (T... args) + + + T + strlen + cpp/string/byte/strlen + + (T... args) + + + T + exp2 + cpp/numeric/math/exp2 + + (T... args) + + std::ctype_byname + std::wcout + + T + setiosflags + cpp/io/manip/setiosflags + + (T... args) + + + T + adjacent_difference + cpp/algorithm/adjacent_difference + + (T... args) + + + T + cos + cpp/numeric/math/cos + + (T... args) + + + T + fwscanf + cpp/io/c/fwscanf + + (T... args) + + + T + atomic_init + cpp/atomic/atomic_init + + (T... args) + + std::fstream + std::valarray + std::ratio_greater_equal + + T + forward_as_tuple + cpp/utility/tuple/forward_as_tuple + + (T... args) + + std::remove_extent + std::ratio_greater + + T + abort + cpp/utility/program/abort + + (T... args) + + + T + wcsncmp + cpp/string/wide/wcsncmp + + (T... args) + + std::intptr_t + std::regex_iterator + + T + set_intersection + cpp/algorithm/set_intersection + + (T... args) + + std::lock_guard + std::wbuffer_convert + std::modulus + std::ratio_divide + + T + atomic_signal_fence + cpp/atomic/atomic_signal_fence + + (T... args) + + + T + llabs + cpp/numeric/math/abs + + (T... args) + + + T + make_move_iterator + cpp/iterator/make_move_iterator + + (T... args) + + std::ostreambuf_iterator + std::dynarray + std::is_nothrow_move_constructible + std::vector + + T + scanf + cpp/io/c/fscanf + + (T... args) + + std::match_results + std::back_insert_iterator + + T + nextafter + cpp/numeric/math/nextafter + + (T... args) + + std::iterator + std::int8_t + + T + stol + cpp/string/basic_string/stol + + (T... args) + + + T + strcspn + cpp/string/byte/strcspn + + (T... args) + + + T + ungetwc + cpp/io/c/ungetwc + + (T... args) + + + T + transform + cpp/algorithm/transform + + (T... args) + + std::student_t_distribution + std::mt19937_64 + std::runtime_error + + T + putc + cpp/io/c/fputc + + (T... args) + + + T + iswdigit + cpp/string/wide/iswdigit + + (T... args) + + std::ranlux24_base + + T + rint + cpp/numeric/math/rint + + (T... args) + + std::allocator_traits + + T + memset + cpp/string/byte/memset + + (T... args) + + + T + isgraph + cpp/string/byte/isgraph + + (T... args) + + std::codecvt + std::ratio_less_equal + + T + replace_copy_if + cpp/algorithm/replace_copy + + (T... args) + + + T + scalbn + cpp/numeric/math/scalbn + + (T... args) + + std::condition_variable_any + + T + partial_sort_copy + cpp/algorithm/partial_sort_copy + + (T... args) + + std::deca + std::extreme_value_distribution + std::cout + std::decay + std::is_trivially_move_assignable + std::adopt_lock_t + + T + make_exception_ptr + cpp/error/make_exception_ptr + + (T... args) + + std::wcerr + + T + frexp + cpp/numeric/math/frexp + + (T... args) + + std::lognormal_distribution + + T + isxdigit + cpp/string/byte/isxdigit + + (T... args) + + std::wclog + + T + atomic_exchange_explicit + cpp/atomic/atomic_exchange + + (T... args) + + + T + wprintf + cpp/io/c/fwprintf + + (T... args) + + std::char_traits + std::remove_reference + + T + fdim + cpp/numeric/math/fdim + + (T... args) + + std::num_get + + T + wctype + cpp/string/wide/wctype + + (T... args) + + std::is_pointer + + T + mbrtoc32 + cpp/string/multibyte/mbrtoc32 + + (T... args) + + + T + setw + cpp/io/manip/setw + + (T... args) + + + T + get_temporary_buffer + cpp/memory/get_temporary_buffer + + (T... args) + + + T + fmax + cpp/numeric/math/fmax + + (T... args) + + std::multiset + + T + atomic_thread_fence + cpp/atomic/atomic_thread_fence + + (T... args) + + + T + atomic_exchange + cpp/atomic/atomic_exchange + + (T... args) + + std::weak_ptr + std::bidirectional_iterator_tag + std::wstring_convert + + T + fgetwc + cpp/io/c/fgetwc + + (T... args) + + + T + swprintf + cpp/io/c/fwprintf + + (T... args) + + + T + prev_permutation + cpp/algorithm/prev_permutation + + (T... args) + + std::greater_equal + std::is_trivially_constructible + + T + max_element + cpp/algorithm/max_element + + (T... args) + + std::string + std::discrete_distribution + std::wostream + std::is_polymorphic + + T + set_symmetric_difference + cpp/algorithm/set_symmetric_difference + + (T... args) + + + T + wcscpy + cpp/string/wide/wcscpy + + (T... args) + + + T + const_pointer_cast + cpp/memory/shared_ptr/pointer_cast + + (T... args) + + + T + minmax_element + cpp/algorithm/minmax_element + + (T... args) + + + T + wcstok + cpp/string/wide/wcstok + + (T... args) + + + T + ref + cpp/utility/functional/ref + + (T... args) + + std::reverse_iterator + + T + feupdateenv + cpp/numeric/fenv/feupdateenv + + (T... args) + + std::bad_array_new_length + + T + endl + cpp/io/manip/endl + + (T... args) + + + T + end + cpp/iterator/end + + (T... args) + + std::condition_variable + + T + wmemmove + cpp/string/wide/wmemmove + + (T... args) + + + T + fmin + cpp/numeric/math/fmin + + (T... args) + + + T + uninitialized_fill_n + cpp/memory/uninitialized_fill_n + + (T... args) + + std::ranlux48 + + T + nouppercase + cpp/io/manip/uppercase + + (T... args) + + + T + noshowpos + cpp/io/manip/showpos + + (T... args) + + + T + ctime + cpp/chrono/c/ctime + + (T... args) + + + T + wmemset + cpp/string/wide/wmemset + + (T... args) + + std::unexpected_handler + + T + iswpunct + cpp/string/wide/iswpunct + + (T... args) + + std::piecewise_constant_distribution + std::codecvt_base + std::set + + T + pop_heap + cpp/algorithm/pop_heap + + (T... args) + + + T + sprintf + cpp/io/c/fprintf + + (T... args) + + + T + fixed + cpp/io/manip/fixed + + (T... args) + + + T + make_shared + cpp/memory/shared_ptr/make_shared + + (T... args) + + std::forward_iterator_tag + std::codecvt_byname + std::pointer_safety + std::uint_least64_t + std::placeholders + std::nothrow_t + std::is_nothrow_copy_assignable + std::is_same + + T + make_heap + cpp/algorithm/make_heap + + (T... args) + + + T + fmod + cpp/numeric/math/fmod + + (T... args) + + std::unique_lock + std::basic_ostringstream + + T + atol + cpp/string/byte/atoi + + (T... args) + + std::is_error_code_enum + std::time_put_byname + + T + uninitialized_copy + cpp/memory/uninitialized_copy + + (T... args) + + std::time_get + + T + dynamic_pointer_cast + cpp/memory/shared_ptr/pointer_cast + + (T... args) + + + T + set_union + cpp/algorithm/set_union + + (T... args) + + std::regex + std::cin + + T + hexfloat + cpp/io/manip/fixed + + (T... args) + + + T + vswprintf + cpp/io/c/vfwprintf + + (T... args) + + + T + asctime + cpp/chrono/c/asctime + + (T... args) + + std::unordered_map + + T + iswspace + cpp/string/wide/iswspace + + (T... args) + + std::initializer_list + + T + nan + cpp/numeric/math/nan + + (T... args) + + + T + sort + cpp/algorithm/sort + + (T... args) + + + T + quick_exit + cpp/utility/program/quick_exit + + (T... args) + + std::is_const + + T + log10 + cpp/numeric/math/log10 + + (T... args) + + std::basic_regex + + T + mbstowcs + cpp/string/multibyte/mbstowcs + + (T... args) + + + T + isspace + cpp/string/byte/isspace + + (T... args) + + std::poisson_distribution + std::bad_typeid + + T + strncat + cpp/string/byte/strncat + + (T... args) + + std::less_equal + + T + isinf + cpp/numeric/math/isinf + + (T... args) + + + T + atof + cpp/string/byte/atof + + (T... args) + + std::sig_atomic_t + + T + erf + cpp/numeric/math/erf + + (T... args) + + + T + is_sorted_until + cpp/algorithm/is_sorted_until + + (T... args) + + + T + cbrt + cpp/numeric/math/cbrt + + (T... args) + + + T + log1p + cpp/numeric/math/log1p + + (T... args) + + + T + return_temporary_buffer + cpp/memory/return_temporary_buffer + + (T... args) + + + T + mbsrtowcs + cpp/string/multibyte/mbsrtowcs + + (T... args) + + + T + feraiseexcept + cpp/numeric/fenv/feraiseexcept + + (T... args) + + + T + fseek + cpp/io/c/fseek + + (T... args) + + std::make_unsigned + std::basic_filebuf + + T + atomic_fetch_or_explicit + cpp/atomic/atomic_fetch_or + + (T... args) + + std::logical_or + + T + log + cpp/numeric/math/log + + (T... args) + + + T + putchar + cpp/io/c/putchar + + (T... args) + + + T + make_tuple + cpp/utility/tuple/make_tuple + + (T... args) + + + T + expm1 + cpp/numeric/math/expm1 + + (T... args) + + std::wstringbuf + + T + fma + cpp/numeric/math/fma + + (T... args) + + std::kilo + std::bernoulli_distribution + + T + remove_copy_if + cpp/algorithm/remove_copy + + (T... args) + + + T + showpoint + cpp/io/manip/showpoint + + (T... args) + + std::int16_t + + T + fscanf + cpp/io/c/fscanf + + (T... args) + + + T + stable_partition + cpp/algorithm/stable_partition + + (T... args) + + std::basic_ios + std::int32_t + + T + fill_n + cpp/algorithm/fill_n + + (T... args) + + std::is_rvalue_reference + + T + remove_copy + cpp/algorithm/remove_copy + + (T... args) + + + T + atomic_compare_exchange_strong_explicit + cpp/atomic/atomic_compare_exchange + + (T... args) + + std::integral_constant + std::wsmatch + + T + wctomb + cpp/string/multibyte/wctomb + + (T... args) + + + T + fgets + cpp/io/c/fgets + + (T... args) + + + T + remainder + cpp/numeric/math/remainder + + (T... args) + + std::cerr + std::codecvt_utf8 + + T + allocate_shared + cpp/memory/shared_ptr/allocate_shared + + (T... args) + + std::ratio_add + + T + unique + cpp/algorithm/unique + + (T... args) + + std::is_trivially_move_constructible + + T + includes + cpp/algorithm/includes + + (T... args) + + + T + iswalnum + cpp/string/wide/iswalnum + + (T... args) + + std::wcsub_match + + T + exit + cpp/utility/program/exit + + (T... args) + + + T + put_time + cpp/io/manip/put_time + + (T... args) + + + T + to_string + cpp/string/basic_string/to_string + + (T... args) + + + T + is_heap_until + cpp/algorithm/is_heap_until + + (T... args) + + std::is_member_pointer + + T + wcstold + cpp/string/wide/wcstof + + (T... args) + + std::wstreampos + std::uint_least16_t + + T + stold + cpp/string/basic_string/stof + + (T... args) + + + T + ftell + cpp/io/c/ftell + + (T... args) + + std::tuple + + T + copy_backward + cpp/algorithm/copy_backward + + (T... args) + + + T + wcstoll + cpp/string/wide/wcstol + + (T... args) + + + T + perror + cpp/io/c/perror + + (T... args) + + + T + vwscanf + cpp/io/c/vfwscanf + + (T... args) + + + T + stable_sort + cpp/algorithm/stable_sort + + (T... args) + + std::make_signed + + T + generic_category + cpp/error/generic_category + + (T... args) + + + T + abs(int) + cpp/numeric/math/abs + + (T... args) + + + T + fgetws + cpp/io/c/fgetws + + (T... args) + + std::logic_error + std::sregex_iterator + + T + showpos + cpp/io/manip/showpos + + (T... args) + + std::int_least64_t + + T + exp + cpp/numeric/math/exp + + (T... args) + + std::binary_negate + + T + fill + cpp/algorithm/fill + + (T... args) + + + T + isalpha + cpp/string/byte/isalpha + + (T... args) + + std::discard_block_engine + std::is_trivially_assignable + std::add_cv + + T + lgamma + cpp/numeric/math/lgamma + + (T... args) + + std::pico + std::iterator_traits + std::is_trivially_default_constructible + + T + feclearexcept + cpp/numeric/fenv/feclearexcept + + (T... args) + + + T + wcsncpy + cpp/string/wide/wcsncpy + + (T... args) + + + T + undeclare_reachable + cpp/memory/gc/undeclare_reachable + + (T... args) + + std::shared_ptr + + T + oct + cpp/io/manip/hex + + (T... args) + + std::bad_alloc + std::ostringstream + std::basic_fstream + std::stringbuf + std::exponential_distribution + std::uint32_t + + T + strspn + cpp/string/byte/strspn + + (T... args) + + std::wcregex_iterator + std::bad_function_call + + T + realloc + cpp/memory/c/realloc + + (T... args) + + + T + copy + cpp/algorithm/copy + + (T... args) + + + T + binary_search + cpp/algorithm/binary_search + + (T... args) + + + T + system_category + cpp/error/system_category + + (T... args) + + + T + mbrtowc + cpp/string/multibyte/mbrtowc + + (T... args) + + std::false_type + + T + strtof + cpp/string/byte/strtof + + (T... args) + + + T + mem_fn + cpp/utility/functional/mem_fn + + (T... args) + + std::wregex + + T + distance + cpp/iterator/distance + + (T... args) + + + T + lock + cpp/thread/lock + + (T... args) + + + T + strcmp + cpp/string/byte/strcmp + + (T... args) + + + T + tmpfile + cpp/io/c/tmpfile + + (T... args) + + + T + hypot + cpp/numeric/math/hypot + + (T... args) + + + T + getenv + cpp/utility/program/getenv + + (T... args) + + + T + strrchr + cpp/string/byte/strrchr + + (T... args) + + + T + count + cpp/algorithm/count + + (T... args) + + std::uint_least8_t + + T + tan + cpp/numeric/math/tan + + (T... args) + + + T + strftime + cpp/chrono/c/strftime + + (T... args) + + std::uniform_real_distribution + + T + stod + cpp/string/basic_string/stof + + (T... args) + + + T + towupper + cpp/string/wide/towupper + + (T... args) + + std::smatch + std::cregex_token_iterator + std::range_error + std::is_assignable + + T + atoll + cpp/string/byte/atoi + + (T... args) + + std::is_copy_assignable + std::invalid_argument + + T + atomic_store + cpp/atomic/atomic_store + + (T... args) + + std::is_unsigned + std::jmp_buf + std::is_class + std::geometric_distribution + + T + stoi + cpp/string/basic_string/stol + + (T... args) + + + T + rethrow_exception + cpp/error/rethrow_exception + + (T... args) + + std::uint_fast8_t + + T + sin + cpp/numeric/math/sin + + (T... args) + + + T + atomic_fetch_sub_explicit + cpp/atomic/atomic_fetch_sub + + (T... args) + + + T + unexpected + cpp/error/unexpected + + (T... args) + + + T + mbtowc + cpp/string/multibyte/mbtowc + + (T... args) + + std::mersenne_twister_engine + + T + get_time + cpp/io/manip/get_time + + (T... args) + + + T + partition + cpp/algorithm/partition + + (T... args) + + + T + next + cpp/iterator/next + + (T... args) + + std::is_arithmetic + std::negate + std::try_to_lock_t + std::wfilebuf + std::is_compound + std::iostream + std::is_object + + T + isfinite + cpp/numeric/math/isfinite + + (T... args) + + + T + boolalpha + cpp/io/manip/boolalpha + + (T... args) + + + T + fetestexcept + cpp/numeric/fenv/fetestexcept + + (T... args) + + + T + mbrlen + cpp/string/multibyte/mbrlen + + (T... args) + + std::recursive_mutex + std::is_copy_constructible + + T + iswgraph + cpp/string/wide/iswgraph + + (T... args) + + std::codecvt_utf8_utf16 + std::not_equal_to + std::is_destructible + std::int_fast32_t + + T + time + cpp/chrono/c/time + + (T... args) + + + T + atomic_compare_exchange_strong + cpp/atomic/atomic_compare_exchange + + (T... args) + + std::rank + + T + wcschr + cpp/string/wide/wcschr + + (T... args) + + + T + uppercase + cpp/io/manip/uppercase + + (T... args) + + std::milli + std::deci + + T + lower_bound + cpp/algorithm/lower_bound + + (T... args) + + std::add_lvalue_reference + std::is_bind_expression + std::ios_base + + T + copy_if + cpp/algorithm/copy + + (T... args) + + std::ratio_less + std::int64_t + std::nullptr_t + + T + isnan + cpp/numeric/math/isnan + + (T... args) + + + T + has_facet + cpp/locale/has_facet + + (T... args) + + + T + kill_dependency + cpp/atomic/kill_dependency + + (T... args) + + + T + uninitialized_copy_n + cpp/memory/uninitialized_copy_n + + (T... args) + + std::stack + + T + feholdexcept + cpp/numeric/fenv/feholdexcept + + (T... args) + + + T + div + cpp/numeric/math/div + + (T... args) + + + T + at_quick_exit + cpp/utility/program/at_quick_exit + + (T... args) + + std::uint_fast64_t + std::is_reference + std::ratio + std::shared_future + std::u16streampos + + T + wcspbrk + cpp/string/wide/wcspbrk + + (T... args) + + + T + search + cpp/algorithm/search + + (T... args) + + std::wistream + std::aligned_storage + + T + find_first_of + cpp/algorithm/find_first_of + + (T... args) + + + T + iota + cpp/algorithm/iota + + (T... args) + + std::wstreambuf + + T + declare_reachable + cpp/memory/gc/declare_reachable + + (T... args) + + + T + atomic_compare_exchange_weak + cpp/atomic/atomic_compare_exchange + + (T... args) + + std::binary_function + + T + strtod + cpp/string/byte/strtof + + (T... args) + + + T + accumulate + cpp/algorithm/accumulate + + (T... args) + + + T + wcsrchr + cpp/string/wide/wcsrchr + + (T... args) + + std::out_of_range + + T + min_element + cpp/algorithm/min_element + + (T... args) + + std::independent_bits_engine + + T + clearerr + cpp/io/c/clearerr + + (T... args) + + + T + random_shuffle + cpp/algorithm/random_shuffle + + (T... args) + + std::stringstream + std::tera + + T + iswalpha + cpp/string/wide/iswalpha + + (T... args) + + std::recursive_timed_mutex + std::nano + + T + atomic_fetch_and + cpp/atomic/atomic_fetch_sub + + (T... args) + + + T + wmemchr + cpp/string/wide/wmemchr + + (T... args) + + std::unordered_multimap + std::normal_distribution + + T + bsearch + cpp/algorithm/bsearch + + (T... args) + + + T + ilogb + cpp/numeric/math/ilogb + + (T... args) + + std::minstd_rand + std::is_signed + + T + unique_copy + cpp/algorithm/unique_copy + + (T... args) + + + T + _Exit + cpp/utility/program/_Exit + + (T... args) + + + T + move + cpp/utility/move + + (T... args) + + + T + find_end + cpp/algorithm/find_end + + (T... args) + + std::is_move_constructible + std::unique_ptr + + T + fesetexceptflag + cpp/numeric/fenv/feexceptflag + + (T... args) + + std::is_nothrow_copy_constructible + std::forward_list + std::errc + std::lconv + + T + nth_element + cpp/algorithm/nth_element + + (T... args) + + + T + gets + cpp/io/c/gets + + (T... args) + + + T + lexicographical_compare + cpp/algorithm/lexicographical_compare + + (T... args) + + + T + nearbyint + cpp/numeric/math/nearbyint + + (T... args) + + std::strstreambuf + std::locale + std::equal_to + + T + memcpy + cpp/string/byte/memcpy + + (T... args) + + + T + fwrite + cpp/io/c/fwrite + + (T... args) + + std::divides + std::collate_byname + + T + unitbuf + cpp/io/manip/unitbuf + + (T... args) + + + T + iswlower + cpp/string/wide/iswlower + + (T... args) + + + T + mblen + cpp/string/multibyte/mblen + + (T... args) + + + T + swscanf + cpp/io/c/fwscanf + + (T... args) + + + T + wcstoimax + cpp/string/wide/wcstoimax + + (T... args) + + std::domain_error + + T + fprintf + cpp/io/c/fprintf + + (T... args) + + + T + find_if + cpp/algorithm/find + + (T... args) + + std::is_empty + + T + strtoimax + cpp/string/byte/strtoimax + + (T... args) + + + T + isalnum + cpp/string/byte/isalnum + + (T... args) + + + T + atomic_fetch_add_explicit + cpp/atomic/atomic_fetch_add + + (T... args) + + std::is_nothrow_default_constructible + std::ratio_equal + + T + push_heap + cpp/algorithm/push_heap + + (T... args) + + + T + min + cpp/algorithm/min + + (T... args) + + + T + fwprintf + cpp/io/c/fwprintf + + (T... args) + + std::ostream + std::streamsize + + T + uncaught_exception + cpp/error/uncaught_exception + + (T... args) + + std::shared_lock + + T + strtoll + cpp/string/byte/strtol + + (T... args) + + std::uint8_t + + T + throw_with_nested + cpp/error/throw_with_nested + + (T... args) + + + T + shuffle + cpp/algorithm/random_shuffle + + (T... args) + + + T + isprint + cpp/string/byte/isprint + + (T... args) + + + T + get_new_handler + cpp/memory/new/get_new_handler + + (T... args) + + + T + call_once + cpp/thread/call_once + + (T... args) + + + T + trunc + cpp/numeric/math/trunc + + (T... args) + + + T + wcscspn + cpp/string/wide/wcscspn + + (T... args) + + std::enable_shared_from_this + std::ptrdiff_t + + T + mbrtoc16 + cpp/string/multibyte/mbrtoc16 + + (T... args) + + std::int_fast8_t + std::aligned_union + + T + lround + cpp/numeric/math/round + + (T... args) + + std::future + std::wcmatch + std::overflow_error + std::centi + + T + pow + cpp/numeric/math/pow + + (T... args) + + std::wssub_match + std::is_nothrow_move_assignable + std::pair + + T + tgamma + cpp/numeric/math/tgamma + + (T... args) + + + T + erfc + cpp/numeric/math/erfc + + (T... args) + + + T + llround + cpp/numeric/math/round + + (T... args) + + + T + abs(float) + cpp/numeric/math/fabs + + (T... args) + + + T + asinh + cpp/numeric/math/asinh + + (T... args) + + + T + feof + cpp/io/c/feof + + (T... args) + + std::wsregex_token_iterator + std::weibull_distribution + + T + noskipws + cpp/io/manip/skipws + + (T... args) + + std::less + std::multiplies + + T + find + cpp/algorithm/find + + (T... args) + + + T + atoi + cpp/string/byte/atoi + + (T... args) + + std::is_enum + + T + not1 + cpp/utility/functional/not1 + + (T... args) + + + T + vfscanf + cpp/io/c/vfscanf + + (T... args) + + std::unary_function + + T + stof + cpp/string/basic_string/stof + + (T... args) + + + T + regex_search + cpp/regex/regex_search + + (T... args) + + std::error_code + std::yocto + std::streampos + std::istream_iterator + + T + rotate_copy + cpp/algorithm/rotate_copy + + (T... args) + + + T + set_new_handler + cpp/memory/new/set_new_handler + + (T... args) + + + T + undeclare_no_pointers + cpp/memory/gc/undeclare_no_pointers + + (T... args) + + std::wifstream + + T + async + cpp/thread/async + + (T... args) + + + T + partition_point + cpp/algorithm/partition_point + + (T... args) + + std::moneypunct_byname + + T + vsscanf + cpp/io/c/vfscanf + + (T... args) + + std::terminate_handler + std::ctype_base + std::reference_wrapper + + T + fesetround + cpp/numeric/fenv/feround + + (T... args) + + + T + atomic_is_lock_free + cpp/atomic/atomic_is_lock_free + + (T... args) + + std::ranlux48_base + + T + tanh + cpp/numeric/math/tanh + + (T... args) + + std::bit_not + std::int_fast16_t + + T + ldiv + cpp/numeric/math/div + + (T... args) + + + T + setbase + cpp/io/manip/setbase + + (T... args) + + + T + remove + cpp/algorithm/remove + + (T... args) + + + T + strtol + cpp/string/byte/strtol + + (T... args) + + + T + strpbrk + cpp/string/byte/strpbrk + + (T... args) + + std::error_category + std::regex_traits + + T + signbit + cpp/numeric/math/signbit + + (T... args) + + + T + wcsncat + cpp/string/wide/wcsncat + + (T... args) + + + T + get_money + cpp/io/manip/get_money + + (T... args) + + std::regex_constants + + T + set_difference + cpp/algorithm/set_difference + + (T... args) + + std::negative_binomial_distribution + + T + cref + cpp/utility/functional/ref + + (T... args) + + std::is_union + + T + getline + cpp/string/basic_string/getline + + (T... args) + + std::mt19937 + std::enable_if + + T + to_wstring + cpp/string/basic_string/to_wstring + + (T... args) + + std::chi_squared_distribution + std::add_rvalue_reference + + T + system + cpp/utility/program/system + + (T... args) + + + T + static_pointer_cast + cpp/memory/shared_ptr/pointer_cast + + (T... args) + + std::basic_istream + std::ostream_iterator + + T + wcstoumax + cpp/string/wide/wcstoimax + + (T... args) + + + T + memmove + cpp/string/byte/memmove + + (T... args) + + + T + getwchar + cpp/io/c/getwchar + + (T... args) + + + T + scientific + cpp/io/manip/fixed + + (T... args) + + + T + wcsftime + cpp/chrono/c/wcsftime + + (T... args) + + + T + begin + cpp/iterator/begin + + (T... args) + + + T + ceil + cpp/numeric/math/ceil + + (T... args) + + + T + sinh + cpp/numeric/math/sinh + + (T... args) + + + T + is_permutation + cpp/algorithm/is_permutation + + (T... args) + + std::is_trivially_copy_assignable + + T + generate_n + cpp/algorithm/generate_n + + (T... args) + + + T + acosh + cpp/numeric/math/acosh + + (T... args) + + std::clog + std::is_scalar + + T + advance + cpp/iterator/advance + + (T... args) + + std::uses_allocator + std::piecewise_linear_distribution + std::hash + + T + flush + cpp/io/manip/flush + + (T... args) + + std::shuffle_order_engine + std::chrono + std::greater + std::csub_match + std::uintmax_t + + T + atomic_fetch_xor + cpp/atomic/atomic_fetch_xor + + (T... args) + + std::remove_pointer + std::numeric_limits + + T + ws + cpp/io/manip/ws + + (T... args) + + std::add_volatile + std::once_flag + std::is_literal_type + std::money_base + + T + signal + cpp/utility/program/signal + + (T... args) + + + T + noshowbase + cpp/io/manip/showbase + + (T... args) + + std::peta + std::is_placeholder + + T + generate + cpp/algorithm/generate + + (T... args) + + + T + ldexp + cpp/numeric/math/ldexp + + (T... args) + + std::add_const + std::basic_stringbuf + std::tm + std::is_abstract + std::deque + + T + vsnprintf + cpp/io/c/vfprintf + + (T... args) + + std::allocator + + T + remove_if + cpp/algorithm/remove + + (T... args) + + std::scoped_allocator_adaptor + std::ssub_match + + T + stoull + cpp/string/basic_string/stoul + + (T... args) + + std::messages_byname + + T + fegetexceptflag + cpp/numeric/fenv/feexceptflag + + (T... args) + + + T + find_if_not + cpp/algorithm/find + + (T... args) + + std::promise + + T + merge + cpp/algorithm/merge + + (T... args) + + + T + free + cpp/memory/c/free + + (T... args) + + + T + count_if + cpp/algorithm/count + + (T... args) + + + T + clock + cpp/chrono/c/clock + + (T... args) + + + T + mktime + cpp/chrono/c/mktime + + (T... args) + + std::add_pointer + std::uintptr_t + + T + inserter + cpp/iterator/inserter + + (T... args) + + + T + puts + cpp/io/c/puts + + (T... args) + + std::bit_and + + T + asin + cpp/numeric/math/asin + + (T... args) + + std::uniform_int_distribution + std::type_info + + T + iscntrl + cpp/string/byte/iscntrl + + (T... args) + + + T + difftime + cpp/chrono/c/difftime + + (T... args) + + + T + terminate + cpp/error/terminate + + (T... args) + + + T + memcmp + cpp/string/byte/memcmp + + (T... args) + + std::fisher_f_distribution + + T + uninitialized_fill + cpp/memory/uninitialized_fill + + (T... args) + + std::strstream + + T + hex + cpp/io/manip/hex + + (T... args) + + + T + tie + cpp/utility/tuple/tie + + (T... args) + + + T + back_inserter + cpp/iterator/back_inserter + + (T... args) + + + T + upper_bound + cpp/algorithm/upper_bound + + (T... args) + + std::time_get_byname + std::basic_streambuf + + T + adjacent_find + cpp/algorithm/adjacent_find + + (T... args) + + std::is_nothrow_constructible + + T + use_facet + cpp/locale/use_facet + + (T... args) + + std::queue + std::is_base_of + std::intmax_t + std::ranlux24 + + T + vfwprintf + cpp/io/c/vfwprintf + + (T... args) + + + T + atomic_fetch_add + cpp/atomic/atomic_fetch_add + + (T... args) + + std::remove_cv + + T + fsetpos + cpp/io/c/fsetpos + + (T... args) + + + T + malloc + cpp/memory/c/malloc + + (T... args) + + + T + localtime + cpp/chrono/c/localtime + + (T... args) + + std::is_trivially_destructible + std::wcin + + T + wcscmp + cpp/string/wide/wcscmp + + (T... args) + + + T + c32rtomb + cpp/string/multibyte/c32rtomb + + (T... args) + + + T + isupper + cpp/string/byte/isupper + + (T... args) + + std::atomic + std::basic_stringstream + + T + wcstod + cpp/string/wide/wcstof + + (T... args) + + + T + tolower + cpp/string/byte/tolower + + (T... args) + + std::is_void + + T + sort_heap + cpp/algorithm/sort_heap + + (T... args) + + std::plus + + T + isdigit + cpp/string/byte/isdigit + + (T... args) + + std::bitset + + T + wcslen + cpp/string/wide/wcslen + + (T... args) + + + T + wmemcmp + cpp/string/wide/wmemcmp + + (T... args) + + std::FILE + + T + move_if_noexcept + cpp/utility/move_if_noexcept + + (T... args) + + + T + declval + cpp/utility/declval + + (T... args) + + + T + fpclassify + cpp/numeric/math/fpclassify + + (T... args) + + + T + iswupper + cpp/string/wide/iswupper + + (T... args) + + std::thread + std::future_error + std::time_base + std::alignment_of + std::time_put + std::bit_or + + T + rand + cpp/numeric/random/rand + + (T... args) + + + T + atomic_compare_exchange_weak_explicit + cpp/atomic/atomic_compare_exchange + + (T... args) + + std::pointer_traits + + T + partial_sort + cpp/algorithm/partial_sort + + (T... args) + + std::basic_string + + T + llrint + cpp/numeric/math/rint + + (T... args) + + std::priority_queue + + T + fclose + cpp/io/c/fclose + + (T... args) + + + T + reverse + cpp/algorithm/reverse + + (T... args) + + std::exa + + T + partial_sum + cpp/algorithm/partial_sum + + (T... args) + + std::wostringstream + + T + showbase + cpp/io/manip/showbase + + (T... args) + + std::is_default_constructible + std::cregex_iterator + + T + vswscanf + cpp/io/c/vfwscanf + + (T... args) + + std::wstring + + T + atan + cpp/numeric/math/atan + + (T... args) + + + T + atanh + cpp/numeric/math/atanh + + (T... args) + + std::remove_all_extents + + T + iter_swap + cpp/algorithm/iter_swap + + (T... args) + + + T + scalbln + cpp/numeric/math/scalbn + + (T... args) + + std::istrstream + + T + reverse_copy + cpp/algorithm/reverse_copy + + (T... args) + + std::unary_negate + std::unordered_multiset + std::basic_ostream + std::wsregex_iterator + std::uint_fast16_t + std::is_nothrow_assignable + + T + forward + cpp/utility/forward + + (T... args) + + std::moneypunct + + T + getc + cpp/io/c/fgetc + + (T... args) + + std::type_index + + T + equal_range + cpp/algorithm/equal_range + + (T... args) + + + T + atomic_fetch_sub + cpp/atomic/atomic_fetch_sub + + (T... args) + + + T + is_partitioned + cpp/algorithm/is_partitioned + + (T... args) + + + T + next_permutation + cpp/algorithm/next_permutation + + (T... args) + + + T + isblank + cpp/string/byte/isblank + + (T... args) + + + T + noshowpoint + cpp/io/manip/showpoint + + (T... args) + + + T + atan2 + cpp/numeric/math/atan2 + + (T... args) + + + T + nanf + cpp/numeric/math/nan + + (T... args) + + + T + towctrans + cpp/string/wide/towctrans + + (T... args) + + std::is_standard_layout + std::timed_mutex + + T + right + cpp/io/manip/left + + (T... args) + + + T + fputwc + cpp/io/c/fputwc + + (T... args) + + + T + strtoul + cpp/string/byte/strtoul + + (T... args) + + + T + is_heap + cpp/algorithm/is_heap + + (T... args) + + std::bad_exception + + T + fflush + cpp/io/c/fflush + + (T... args) + + + T + strtoumax + cpp/string/byte/strtoimax + + (T... args) + + + T + nexttoward + cpp/numeric/math/nextafter + + (T... args) + + std::int_fast64_t + std::function + + T + nounitbuf + cpp/io/manip/unitbuf + + (T... args) + + std::bad_cast + std::error_condition + std::filebuf + std::int_least16_t + + T + ispunct + cpp/string/byte/ispunct + + (T... args) + + std::istreambuf_iterator + std::u16string + + T + noboolalpha + cpp/io/manip/boolalpha + + (T... args) + + + T + make_pair + cpp/utility/pair/make_pair + + (T... args) + + std::is_error_condition_enum + std::is_nothrow_destructible + std::wiostream + + T + iswctype + cpp/string/wide/iswctype + + (T... args) + + std::allocator_arg_t + + T + srand + cpp/numeric/random/srand + + (T... args) + + std::rel_ops + std::uint_least32_t + std::collate + + T + replace_copy + cpp/algorithm/replace_copy + + (T... args) + + + T + future_category + cpp/thread/future/future_category + + (T... args) + + std::remove_const + + T + resetiosflags + cpp/io/manip/resetiosflags + + (T... args) + + + T + vprintf + cpp/io/c/vfprintf + + (T... args) + + std::u32string + std::uint_fast32_t + + T + gmtime + cpp/chrono/c/gmtime + + (T... args) + + std::is_lvalue_reference + + T + align + cpp/memory/align + + (T... args) + + + T + tuple_cat + cpp/utility/tuple/tuple_cat + + (T... args) + + + T + ends + cpp/io/manip/ends + + (T... args) + + + T + set_terminate + cpp/error/set_terminate + + (T... args) + + + T + lrint + cpp/numeric/math/rint + + (T... args) + + std::complex + std::ofstream + std::insert_iterator + std::bad_array_length + + T + none_of + cpp/algorithm/all_any_none_of + + (T... args) + + std::this_thread + + T + wscanf + cpp/io/c/fwscanf + + (T... args) + + + T + fputc + cpp/io/c/fputc + + (T... args) + + + T + dec + cpp/io/manip/hex + + (T... args) + + + T + strcat + cpp/string/byte/strcat + + (T... args) + + std::is_trivially_copyable + std::basic_istringstream + std::basic_ifstream + std::list + + T + raise + cpp/utility/program/raise + + (T... args) + + std::minus + + T + wcsspn + cpp/string/wide/wcsspn + + (T... args) + + + T + fabs + cpp/numeric/math/fabs + + (T... args) + + + T + wmemcpy + cpp/string/wide/wmemcpy + + (T... args) + + + T + copy_n + cpp/algorithm/copy_n + + (T... args) + + std::map + std::linear_congruential_engine + + T + rethrow_if_nested + cpp/error/rethrow_if_nested + + (T... args) + + + T + setlocale + cpp/locale/setlocale + + (T... args) + + std::codecvt_utf16 + + T + addressof + cpp/memory/addressof + + (T... args) + + + T + calloc + cpp/memory/c/calloc + + (T... args) + + std::cmatch + + T + strerror + cpp/string/byte/strerror + + (T... args) + + std::defer_lock_t + + T + strcpy + cpp/string/byte/strcpy + + (T... args) + + std::exception + + T + wcstoull + cpp/string/wide/wcstoul + + (T... args) + + + T + c16rtomb + cpp/string/multibyte/c16rtomb + + (T... args) + + std::front_insert_iterator + + T + generate_canonical + cpp/numeric/random/generate_canonical + + (T... args) + + + T + vfprintf + cpp/io/c/vfprintf + + (T... args) + + + T + notify_all_at_thread_exit + cpp/thread/notify_all_at_thread_exit + + (T... args) + + + T + rotate + cpp/algorithm/rotate + + (T... args) + + + T + current_exception + cpp/error/current_exception + + (T... args) + + + T + strtok + cpp/string/byte/strtok + + (T... args) + + + T + wcscat + cpp/string/wide/wcscat + + (T... args) + + + T + strncpy + cpp/string/byte/strncpy + + (T... args) + + + T + towlower + cpp/string/wide/towlower + + (T... args) + + + T + floor + cpp/numeric/math/floor + + (T... args) + + std::zetta + + T + left + cpp/io/manip/left + + (T... args) + + + T + ferror + cpp/io/c/ferror + + (T... args) + + std::streambuf + + T + atomic_load_explicit + cpp/atomic/atomic_load + + (T... args) + + std::experimental + std::num_put + + T + swap + cpp/algorithm/swap + + (T... args) + + + T + acos + cpp/numeric/math/acos + + (T... args) + + std::owner_less + + T + wcscoll + cpp/string/wide/wcscoll + + (T... args) + + + T + sqrt + cpp/numeric/math/sqrt + + (T... args) + + std::extent + + T + mbsinit + cpp/string/multibyte/mbsinit + + (T... args) + + std::bad_optional_access + + T + qsort + cpp/algorithm/qsort + + (T... args) + + + T + stoll + cpp/string/basic_string/stol + + (T... args) + + + T + put_money + cpp/io/manip/put_money + + (T... args) + + + T + wcstoul + cpp/string/wide/wcstoul + + (T... args) + + + T + wcstol + cpp/string/wide/wcstol + + (T... args) + + + T + atexit + cpp/utility/program/atexit + + (T... args) + + + T + atomic_fetch_or + cpp/atomic/atomic_fetch_or + + (T... args) + + + T + rewind + cpp/io/c/rewind + + (T... args) + + + T + wcsxfrm + cpp/string/wide/wcsxfrm + + (T... args) + + std::yotta + std::wcregex_token_iterator + + T + round + cpp/numeric/math/round + + (T... args) + + std::uint64_t + std::messages + + T + vwprintf + cpp/io/c/vfwprintf + + (T... args) + + + T + all_of + cpp/algorithm/all_any_none_of + + (T... args) + + std::regex_token_iterator + + T + replace + cpp/algorithm/replace + + (T... args) + + std::move_iterator + + T + remquo + cpp/numeric/math/remquo + + (T... args) + + + T + setbuf + cpp/io/c/setbuf + + (T... args) + + std::messages_base + + T + strncmp + cpp/string/byte/strncmp + + (T... args) + + + T + localeconv + cpp/locale/localeconv + + (T... args) + + + T + wctrans + cpp/string/wide/wctrans + + (T... args) + + std::istringstream + std::giga + + T + any_of + cpp/algorithm/all_any_none_of + + (T... args) + + std::integer_sequence + + T + equal + cpp/algorithm/equal + + (T... args) + + + T + max + cpp/algorithm/max + + (T... args) + + + T + strxfrm + cpp/string/byte/strxfrm + + (T... args) + + std::has_virtual_destructor + std::max_align_t + std::remove_volatile + std::underlying_type + + T + iswxdigit + cpp/string/wide/iswxdigit + + (T... args) + + + T + labs + cpp/numeric/math/abs + + (T... args) + + std::hecto + + T + regex_match + cpp/regex/regex_match + + (T... args) + + std::is_member_object_pointer + std::exception_ptr + + T + fputws + cpp/io/c/fputws + + (T... args) + + + T + wcrtomb + cpp/string/multibyte/wcrtomb + + (T... args) + + + T + setprecision + cpp/io/manip/setprecision + + (T... args) + + + T + setvbuf + cpp/io/c/setvbuf + + (T... args) + + std::nested_exception + std::random_access_iterator_tag + + T + regex_replace + cpp/regex/regex_replace + + (T... args) + + std::ctype + + T + freopen + cpp/io/c/freopen + + (T... args) + + + T + logb + cpp/numeric/math/logb + + (T... args) + + std::time_t + + T + wctob + cpp/string/multibyte/wctob + + (T... args) + + std::knuth_b + + T + atomic_load + cpp/atomic/atomic_load + + (T... args) + + + T + search_n + cpp/algorithm/search_n + + (T... args) + + + T + toupper + cpp/string/byte/toupper + + (T... args) + + std::auto_ptr + + T + move_backward + cpp/algorithm/move_backward + + (T... args) + + + T + is_sorted + cpp/algorithm/is_sorted + + (T... args) + + std::minstd_rand0 + + T + strtoull + cpp/string/byte/strtoul + + (T... args) + + std::sregex_token_iterator + std::logical_not + std::fpos_t + + T + iswblank + cpp/string/wide/iswblank + + (T... args) + + std::istream + std::seed_seq + std::default_delete + std::femto + std::clock_t + std::true_type + + T + get_pointer_safety + cpp/memory/gc/get_pointer_safety + + (T... args) + + std::mbstate_t + + T + get_unexpected + cpp/error/get_unexpected + + (T... args) + + + T + sscanf + cpp/io/c/fscanf + + (T... args) + + std::ostrstream + std::gamma_distribution + std::bad_weak_ptr + std::output_iterator_tag + std::micro + std::is_trivial + + T + fesetenv + cpp/numeric/fenv/feenv + + (T... args) + + + T + atomic_store_explicit + cpp/atomic/atomic_store + + (T... args) + + + T + strtold + cpp/string/byte/strtof + + (T... args) + + + T + fread + cpp/io/c/fread + + (T... args) + + std::packaged_task + std::unordered_set + std::is_volatile + + T + memchr + cpp/string/byte/memchr + + (T... args) + + + T + btowc + cpp/string/multibyte/btowc + + (T... args) + + std::wfstream + + T + replace_if + cpp/algorithm/replace + + (T... args) + + std::multimap + + T + strcoll + cpp/string/byte/strcoll + + (T... args) + + + T + vsprintf + cpp/io/c/vfprintf + + (T... args) + + + T + mismatch + cpp/algorithm/mismatch + + (T... args) + + + T + getchar + cpp/io/c/getchar + + (T... args) + + std::atomic_flag + + T + islower + cpp/string/byte/islower + + (T... args) + + + T + tmpnam + cpp/io/c/tmpnam + + (T... args) + + std::numpunct_byname + + T + nanl + cpp/numeric/math/nan + + (T... args) + + std::binomial_distribution + + T + fopen + cpp/io/c/fopen + + (T... args) + + std::basic_iostream + std::wofstream + std::fpos + std::underflow_error + + T + for_each + cpp/algorithm/for_each + + (T... args) + + + T + fegetround + cpp/numeric/fenv/feround + + (T... args) + + + T + ungetc + cpp/io/c/ungetc + + (T... args) + + std::cauchy_distribution + std::is_trivially_copy_constructible + std::conditional + std::is_pod + + T + internal + cpp/io/manip/left + + (T... args) + + + T + vfwscanf + cpp/io/c/vfwscanf + + (T... args) + + std::int_least8_t + + T + fgetc + cpp/io/c/fgetc + + (T... args) + + std::streamoff + std::is_move_assignable + std::int_least32_t + + T + wcstof + cpp/string/wide/wcstof + + (T... args) + + std::wstringstream + std::subtract_with_carry_engine + std::regex_error + + T + bind + cpp/utility/functional/bind + + (T... args) + + + T + skipws + cpp/io/manip/skipws + + (T... args) + + std::is_constructible + std::piecewise_construct_t + + T + iswprint + cpp/string/wide/iswprint + + (T... args) + + + T + wcstombs + cpp/string/multibyte/wcstombs + + (T... args) + + + T + inplace_merge + cpp/algorithm/inplace_merge + + (T... args) + + + T + copysign + cpp/numeric/math/copysign + + (T... args) + + + T + putwchar + cpp/io/c/putwchar + + (T... args) + + std::mutex + + T + wcsstr + cpp/string/wide/wcsstr + + (T... args) + + + T + fegetenv + cpp/numeric/fenv/feenv + + (T... args) + + + T + longjmp + cpp/utility/program/longjmp + + (T... args) + + + T + iswcntrl + cpp/string/wide/iswcntrl + + (T... args) + + std::system_error + + T + declare_no_pointers + cpp/memory/gc/declare_no_pointers + + (T... args) + + + T + isnormal + cpp/numeric/math/isnormal + + (T... args) + + + T + swap_ranges + cpp/algorithm/swap_ranges + + (T... args) + + std::wistringstream + std::is_floating_point + + T + minmax + cpp/algorithm/minmax + + (T... args) + + + T + defaultfloat + cpp/io/manip/fixed + + (T... args) + + + T + rename + cpp/io/c/rename + + (T... args) + + + T + snprintf + cpp/io/c/fprintf + + (T... args) + + + T + try_lock + cpp/thread/try_lock + + (T... args) + + std::ratio_not_equal + std::ratio_multiply + std::result_of + std::is_fundamental + + T + stoul + cpp/string/basic_string/stoul + + (T... args) + + std::ifstream + std::u32streampos + + T + fgetpos + cpp/io/c/fgetpos + + (T... args) + + std::length_error + + T + partition_copy + cpp/algorithm/partition_copy + + (T... args) + + + T + vscanf + cpp/io/c/vfscanf + + (T... args) + + + T + front_inserter + cpp/iterator/front_inserter + + (T... args) + + std::sub_match + std::common_type + + T + get_terminate + cpp/error/get_terminate + + (T... args) + + + T + cosh + cpp/numeric/math/cosh + + (T... args) + + std::shared_timed_mutex + std::array + std::random_device + std::default_random_engine + std::raw_storage_iterator + std::is_convertible + + T + prev + cpp/iterator/prev + + (T... args) + + std::uint16_t + + T + strchr + cpp/string/byte/strchr + + (T... args) + + std::is_array + + T + strstr + cpp/string/byte/strstr + + (T... args) + + std::mega + + T + printf + cpp/io/c/fprintf + + (T... args) + + std::numpunct + std::money_put + std::new_handler + std::is_member_function_pointer + + T + setfill + cpp/io/manip/setfill + + (T... args) + + + T + inner_product + cpp/algorithm/inner_product + + (T... args) + + + + std::is_function + cpp/types/is_function + + + std::input_iterator_tag + cpp/iterator/iterator_tags + + + std::logical_and + cpp/utility/functional/logical_and + + T + operator() + cpp/utility/functional/logical_and + + (T... args) + + + + std::is_integral + cpp/types/is_integral + + + std::money_get + cpp/locale/money_get + + T + do_get + cpp/locale/money_get/get + + (T... args) + + std::money_get::char_type + std::money_get::pattern + + T + get + cpp/locale/money_get/get + + (T... args) + + + T + ~money_get + cpp/locale/money_get/~money_get + + (T... args) + + std::money_get::string_type + std::money_get::iter_type + + T + money_get + cpp/locale/money_get/money_get + + (T... args) + + + + std::money_get::char_type + cpp/locale/money_get + + + std::money_get::pattern + cpp/locale/money_base + + + std::money_get::string_type + cpp/locale/money_get + + + std::money_get::iter_type + cpp/locale/money_get + + + std::basic_ofstream + cpp/io/basic_ofstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + basic_ofstream + cpp/io/basic_ofstream/basic_ofstream + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::basic_ofstream::event_callback + + T + open + cpp/io/basic_ofstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ofstream/close + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_ofstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ofstream/is_open + + (T... args) + + + T + operator= + cpp/io/basic_ofstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::basic_ofstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_ofstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_ofstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_ofstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::ratio_subtract + cpp/numeric/ratio/ratio_subtract + + + std::size_t + cpp/types/size_t + + + std::ctype_byname + cpp/locale/ctype_byname + + T + ~ctype_byname + cpp/locale/ctype_byname + + (T... args) + + + T + ctype_byname + cpp/locale/ctype_byname + + (T... args) + + + T + do_toupper + cpp/locale/ctype/toupper + + (T... args) + + + T + toupper + cpp/locale/ctype/toupper + + (T... args) + + + T + do_scan_is + cpp/locale/ctype/scan_is + + (T... args) + + + T + do_tolower + cpp/locale/ctype/tolower + + (T... args) + + + T + do_narrow + cpp/locale/ctype/narrow + + (T... args) + + + T + widen + cpp/locale/ctype/widen + + (T... args) + + + T + is + cpp/locale/ctype/is + + (T... args) + + + T + scan_is + cpp/locale/ctype/scan_is + + (T... args) + + + T + tolower + cpp/locale/ctype/tolower + + (T... args) + + + T + do_is + cpp/locale/ctype/is + + (T... args) + + + T + narrow + cpp/locale/ctype/narrow + + (T... args) + + std::ctype_byname::mask + + T + do_widen + cpp/locale/ctype/widen + + (T... args) + + + + std::ctype_byname::mask + cpp/locale/ctype_base + + + std::wcout + cpp/io/basic_ostream + + + std::fstream + cpp/io/basic_fstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + open + cpp/io/basic_fstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + fstream + cpp/io/basic_fstream/basic_fstream + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::fstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::fstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + close + cpp/io/basic_fstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::fstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_fstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_fstream/operator= + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::fstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::fstream::event_callback + cpp/io/ios_base/event_callback + + + std::fstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::valarray + cpp/numeric/valarray + + + std::ratio_greater_equal + cpp/numeric/ratio/ratio_greater_equal + + + std::remove_extent + cpp/types/remove_extent + + + std::ratio_greater + cpp/numeric/ratio/ratio_greater + + + std::intptr_t + cpp/types/integer + + + std::regex_iterator + cpp/regex/regex_iterator + + T + operator!= + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + regex_iterator + cpp/regex/regex_iterator/regex_iterator + + (T... args) + + + T + operator++ + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + + std::lock_guard + cpp/thread/lock_guard + + T + ~lock_guard + cpp/thread/lock_guard/~lock_guard + + (T... args) + + + T + lock_guard + cpp/thread/lock_guard/lock_guard + + (T... args) + + + + std::wbuffer_convert + cpp/locale/wbuffer_convert + + T + state + cpp/locale/wbuffer_convert/state + + (T... args) + + + T + wbuffer_convert + cpp/locale/wbuffer_convert/wbuffer_convert + + (T... args) + + + T + rdbuf + cpp/locale/wbuffer_convert/rdbuf + + (T... args) + + + T + ~wbuffer_convert + cpp/locale/wbuffer_convert/~wbuffer_convert + + (T... args) + + + + std::modulus + cpp/utility/functional/modulus + + T + operator() + cpp/utility/functional/modulus + + (T... args) + + + + std::ratio_divide + cpp/numeric/ratio/ratio_divide + + + std::ostreambuf_iterator + cpp/iterator/ostreambuf_iterator + + + std::dynarray + cpp/container/dynarray + + T + rbegin + cpp/container/dynarray/rbegin + + (T... args) + + + T + crend + cpp/container/dynarray/rend + + (T... args) + + + T + begin + cpp/container/dynarray/begin + + (T... args) + + + T + data + cpp/container/dynarray/data + + (T... args) + + + T + at + cpp/container/dynarray/at + + (T... args) + + + T + back + cpp/container/dynarray/back + + (T... args) + + + T + end + cpp/container/dynarray/end + + (T... args) + + + T + fill + cpp/container/dynarray/fill + + (T... args) + + + T + empty + cpp/container/dynarray/empty + + (T... args) + + + T + size + cpp/container/dynarray/size + + (T... args) + + + T + cend + cpp/container/dynarray/end + + (T... args) + + + T + ~dynarray + cpp/container/dynarray/~dynarray + + (T... args) + + + T + max_size + cpp/container/dynarray/max_size + + (T... args) + + + T + rend + cpp/container/dynarray/rend + + (T... args) + + + T + front + cpp/container/dynarray/front + + (T... args) + + + T + dynarray + cpp/container/dynarray/dynarray + + (T... args) + + + T + operator[] + cpp/container/dynarray/operator_at + + (T... args) + + + T + crbegin + cpp/container/dynarray/rbegin + + (T... args) + + + T + cbegin + cpp/container/dynarray/begin + + (T... args) + + + + std::is_nothrow_move_constructible + cpp/types/is_move_constructible + + + std::vector + cpp/container/vector + + T + push_back + cpp/container/vector/push_back + + (T... args) + + + T + crbegin + cpp/container/vector/rbegin + + (T... args) + + + T + erase + cpp/container/vector/erase + + (T... args) + + + T + data + cpp/container/vector/data + + (T... args) + + + T + insert + cpp/container/vector/insert + + (T... args) + + + T + pop_back + cpp/container/vector/pop_back + + (T... args) + + + T + shrink_to_fit + cpp/container/vector/shrink_to_fit + + (T... args) + + + T + back + cpp/container/vector/back + + (T... args) + + + T + end + cpp/container/vector/end + + (T... args) + + + T + resize + cpp/container/vector/resize + + (T... args) + + + T + emplace_back + cpp/container/vector/emplace_back + + (T... args) + + + T + size + cpp/container/vector/size + + (T... args) + + + T + cbegin + cpp/container/vector/begin + + (T... args) + + + T + front + cpp/container/vector/front + + (T... args) + + + T + ~vector + cpp/container/vector/~vector + + (T... args) + + + T + rbegin + cpp/container/vector/rbegin + + (T... args) + + + T + crend + cpp/container/vector/rend + + (T... args) + + + T + assign + cpp/container/vector/assign + + (T... args) + + + T + operator= + cpp/container/vector/operator= + + (T... args) + + + T + vector + cpp/container/vector/vector + + (T... args) + + + T + reserve + cpp/container/vector/reserve + + (T... args) + + + T + capacity + cpp/container/vector/capacity + + (T... args) + + + T + empty + cpp/container/vector/empty + + (T... args) + + + T + cend + cpp/container/vector/end + + (T... args) + + + T + swap + cpp/container/vector/swap + + (T... args) + + + T + max_size + cpp/container/vector/max_size + + (T... args) + + + T + rend + cpp/container/vector/rend + + (T... args) + + + T + get_allocator + cpp/container/vector/get_allocator + + (T... args) + + + T + clear + cpp/container/vector/clear + + (T... args) + + + T + at + cpp/container/vector/at + + (T... args) + + + T + emplace + cpp/container/vector/emplace + + (T... args) + + + T + operator[] + cpp/container/vector/operator_at + + (T... args) + + + T + begin + cpp/container/vector/begin + + (T... args) + + + + std::match_results + cpp/regex/match_results + + T + cbegin + cpp/regex/match_results/begin + + (T... args) + + + T + format + cpp/regex/match_results/format + + (T... args) + + + T + ~match_results + cpp/regex/match_results/~match_results + + (T... args) + + + T + size + cpp/regex/match_results/size + + (T... args) + + + T + swap + cpp/regex/match_results/swap + + (T... args) + + + T + position + cpp/regex/match_results/position + + (T... args) + + + T + prefix + cpp/regex/match_results/prefix + + (T... args) + + + T + str + cpp/regex/match_results/str + + (T... args) + + + T + begin + cpp/regex/match_results/begin + + (T... args) + + + T + empty + cpp/regex/match_results/empty + + (T... args) + + + T + suffix + cpp/regex/match_results/suffix + + (T... args) + + + T + get_allocator + cpp/regex/match_results/get_allocator + + (T... args) + + + T + end + cpp/regex/match_results/end + + (T... args) + + + T + match_results + cpp/regex/match_results/match_results + + (T... args) + + + T + ready + cpp/regex/match_results/ready + + (T... args) + + + T + cend + cpp/regex/match_results/end + + (T... args) + + + T + operator[] + cpp/regex/match_results/operator_at + + (T... args) + + + T + length + cpp/regex/match_results/length + + (T... args) + + + T + max_size + cpp/regex/match_results/max_size + + (T... args) + + + + std::back_insert_iterator + cpp/iterator/back_insert_iterator + + + std::iterator + cpp/iterator/iterator + + + std::int8_t + cpp/types/integer + + + std::student_t_distribution + cpp/numeric/random/student_t_distribution + + T + n + cpp/numeric/random/student_t_distribution/n + + (T... args) + + + T + reset + cpp/numeric/random/student_t_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/student_t_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/student_t_distribution/operator() + + (T... args) + + + T + student_t_distribution + cpp/numeric/random/student_t_distribution/student_t_distribution + + (T... args) + + + T + param + cpp/numeric/random/student_t_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/student_t_distribution/min + + (T... args) + + + + std::mt19937_64 + cpp/numeric/random/mersenne_twister_engine + + T + discard + cpp/numeric/random/mersenne_twister_engine/discard + + (T... args) + + + T + mt19937_64 + cpp/numeric/random/mersenne_twister_engine/mersenne_twister_engine + + (T... args) + + + T + max + cpp/numeric/random/mersenne_twister_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/mersenne_twister_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/mersenne_twister_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/mersenne_twister_engine/min + + (T... args) + + + + std::runtime_error + cpp/error/runtime_error + + T + runtime_error + cpp/error/runtime_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ranlux24_base + cpp/numeric/random/subtract_with_carry_engine + + T + discard + cpp/numeric/random/subtract_with_carry_engine/discard + + (T... args) + + + T + ranlux24_base + cpp/numeric/random/subtract_with_carry_engine/subtract_with_carry_engine + + (T... args) + + + T + max + cpp/numeric/random/subtract_with_carry_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/subtract_with_carry_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/subtract_with_carry_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/subtract_with_carry_engine/min + + (T... args) + + + + std::allocator_traits + cpp/memory/allocator_traits + + T + destroy + cpp/memory/allocator_traits/destroy + + (T... args) + + + T + select_on_container_copy_construction + cpp/memory/allocator_traits/select_on_container_copy_construction + + (T... args) + + + T + max_size + cpp/memory/allocator_traits/max_size + + (T... args) + + + T + allocate + cpp/memory/allocator_traits/allocate + + (T... args) + + + T + deallocate + cpp/memory/allocator_traits/deallocate + + (T... args) + + + T + construct + cpp/memory/allocator_traits/construct + + (T... args) + + + + std::codecvt + cpp/locale/codecvt + std::codecvt::extern_type + + T + out + cpp/locale/codecvt/out + + (T... args) + + + T + do_length + cpp/locale/codecvt/length + + (T... args) + + + T + always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + do_encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + do_in + cpp/locale/codecvt/in + + (T... args) + + + T + unshift + cpp/locale/codecvt/unshift + + (T... args) + + std::codecvt::state_type + + T + max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + codecvt + cpp/locale/codecvt/codecvt + + (T... args) + + + T + do_unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + do_out + cpp/locale/codecvt/out + + (T... args) + + + T + do_max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + do_always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + in + cpp/locale/codecvt/in + + (T... args) + + std::codecvt::intern_type + + T + length + cpp/locale/codecvt/length + + (T... args) + + + T + ~codecvt + cpp/locale/codecvt/~codecvt + + (T... args) + + + + std::codecvt::extern_type + cpp/locale/codecvt + + + std::codecvt::state_type + cpp/locale/codecvt + + + std::codecvt::intern_type + cpp/locale/codecvt + + + std::ratio_less_equal + cpp/numeric/ratio/ratio_less_equal + + + std::condition_variable_any + cpp/thread/condition_variable_any + + T + condition_variable_any + cpp/thread/condition_variable_any/condition_variable_any + + (T... args) + + + T + notify_one + cpp/thread/condition_variable_any/notify_one + + (T... args) + + + T + wait_for + cpp/thread/condition_variable_any/wait_for + + (T... args) + + + T + native_handle + cpp/thread/condition_variable_any/native_handle + + (T... args) + + + T + notify_all + cpp/thread/condition_variable_any/notify_all + + (T... args) + + + T + ~condition_variable_any + cpp/thread/condition_variable_any/~condition_variable_any + + (T... args) + + + T + wait_until + cpp/thread/condition_variable_any/wait_until + + (T... args) + + + T + wait + cpp/thread/condition_variable_any/wait + + (T... args) + + + + std::deca + cpp/numeric/ratio/ratio + + + std::extreme_value_distribution + cpp/numeric/random/extreme_value_distribution + + T + max + cpp/numeric/random/extreme_value_distribution/max + + (T... args) + + + T + b + cpp/numeric/random/extreme_value_distribution/params + + (T... args) + + + T + a + cpp/numeric/random/extreme_value_distribution/params + + (T... args) + + + T + operator() + cpp/numeric/random/extreme_value_distribution/operator() + + (T... args) + + + T + extreme_value_distribution + cpp/numeric/random/extreme_value_distribution/extreme_value_distribution + + (T... args) + + + T + param + cpp/numeric/random/extreme_value_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/extreme_value_distribution/min + + (T... args) + + + T + reset + cpp/numeric/random/extreme_value_distribution/reset + + (T... args) + + + + std::cout + cpp/io/basic_ostream + + + std::decay + cpp/types/decay + + + std::is_trivially_move_assignable + cpp/types/is_move_assignable + + + std::adopt_lock_t + cpp/thread/lock_tag_t + + + std::wcerr + cpp/io/basic_ostream + + + std::lognormal_distribution + cpp/numeric/random/lognormal_distribution + + T + max + cpp/numeric/random/lognormal_distribution/max + + (T... args) + + + T + reset + cpp/numeric/random/lognormal_distribution/reset + + (T... args) + + + T + lognormal_distribution + cpp/numeric/random/lognormal_distribution/lognormal_distribution + + (T... args) + + + T + m + cpp/numeric/random/lognormal_distribution/params + + (T... args) + + + T + operator() + cpp/numeric/random/lognormal_distribution/operator() + + (T... args) + + + T + s + cpp/numeric/random/lognormal_distribution/params + + (T... args) + + + T + param + cpp/numeric/random/lognormal_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/lognormal_distribution/min + + (T... args) + + + + std::wclog + cpp/io/basic_ostream + + + std::char_traits + cpp/string/char_traits + + T + assign + cpp/string/char_traits/assign + + (T... args) + + + T + not_eof + cpp/string/char_traits/not_eof + + (T... args) + + + T + to_int_type + cpp/string/char_traits/to_int_type + + (T... args) + + + T + to_char_type + cpp/string/char_traits/to_char_type + + (T... args) + + + T + eq + cpp/string/char_traits/cmp + + (T... args) + + + T + copy + cpp/string/char_traits/copy + + (T... args) + + + T + length + cpp/string/char_traits/length + + (T... args) + + + T + lt + cpp/string/char_traits/cmp + + (T... args) + + + T + eof + cpp/string/char_traits/eof + + (T... args) + + + T + find + cpp/string/char_traits/find + + (T... args) + + + T + move + cpp/string/char_traits/move + + (T... args) + + + T + compare + cpp/string/char_traits/compare + + (T... args) + + + T + eq_int_type + cpp/string/char_traits/eq_int_type + + (T... args) + + + + std::remove_reference + cpp/types/remove_reference + + + std::num_get + cpp/locale/num_get + + T + do_get + cpp/locale/num_get/get + + (T... args) + + std::num_get::char_type + std::num_get::iter_type + + T + num_get + cpp/locale/num_get/num_get + + (T... args) + + + T + ~num_get + cpp/locale/num_get/~num_get + + (T... args) + + + T + get + cpp/locale/num_get/get + + (T... args) + + + + std::num_get::char_type + cpp/locale/num_get + + + std::num_get::iter_type + cpp/locale/num_get + + + std::is_pointer + cpp/types/is_pointer + + + std::multiset + cpp/container/multiset + + T + begin + cpp/container/multiset/begin + + (T... args) + + + T + erase + cpp/container/multiset/erase + + (T... args) + + + T + insert + cpp/container/multiset/insert + + (T... args) + + + T + swap + cpp/container/multiset/swap + + (T... args) + + + T + end + cpp/container/multiset/end + + (T... args) + + + T + emplace_hint + cpp/container/multiset/emplace_hint + + (T... args) + + + T + key_comp + cpp/container/multiset/key_comp + + (T... args) + + + T + cbegin + cpp/container/multiset/begin + + (T... args) + + + T + count + cpp/container/multiset/count + + (T... args) + + + T + find + cpp/container/multiset/find + + (T... args) + + + T + crbegin + cpp/container/multiset/rbegin + + (T... args) + + + T + multiset + cpp/container/multiset/multiset + + (T... args) + + + T + upper_bound + cpp/container/multiset/upper_bound + + (T... args) + + + T + rbegin + cpp/container/multiset/rbegin + + (T... args) + + + T + crend + cpp/container/multiset/rend + + (T... args) + + + T + size + cpp/container/multiset/size + + (T... args) + + + T + operator= + cpp/container/multiset/operator= + + (T... args) + + + T + ~multiset + cpp/container/multiset/~multiset + + (T... args) + + + T + value_comp + cpp/container/multiset/value_comp + + (T... args) + + + T + empty + cpp/container/multiset/empty + + (T... args) + + + T + lower_bound + cpp/container/multiset/lower_bound + + (T... args) + + + T + get_allocator + cpp/container/multiset/get_allocator + + (T... args) + + + T + max_size + cpp/container/multiset/max_size + + (T... args) + + + T + rend + cpp/container/multiset/rend + + (T... args) + + + T + cend + cpp/container/multiset/end + + (T... args) + + + T + clear + cpp/container/multiset/clear + + (T... args) + + + T + equal_range + cpp/container/multiset/equal_range + + (T... args) + + + T + emplace + cpp/container/multiset/emplace + + (T... args) + + + + std::weak_ptr + cpp/memory/weak_ptr + + T + operator= + cpp/memory/weak_ptr/operator= + + (T... args) + + + T + swap + cpp/memory/weak_ptr/swap + + (T... args) + + + T + weak_ptr + cpp/memory/weak_ptr/weak_ptr + + (T... args) + + + T + owner_before + cpp/memory/weak_ptr/owner_before + + (T... args) + + + T + ~weak_ptr + cpp/memory/weak_ptr/~weak_ptr + + (T... args) + + + T + use_count + cpp/memory/weak_ptr/use_count + + (T... args) + + + T + expired + cpp/memory/weak_ptr/expired + + (T... args) + + + T + lock + cpp/memory/weak_ptr/lock + + (T... args) + + + T + reset + cpp/memory/weak_ptr/reset + + (T... args) + + + + std::bidirectional_iterator_tag + cpp/iterator/iterator_tags + + + std::wstring_convert + cpp/locale/wstring_convert + + T + converted + cpp/locale/wstring_convert/converted + + (T... args) + + + T + to_bytes + cpp/locale/wstring_convert/to_bytes + + (T... args) + + + T + ~wstring_convert + cpp/locale/wstring_convert/~wstring_convert + + (T... args) + + + T + state + cpp/locale/wstring_convert/state + + (T... args) + + + T + wstring_convert + cpp/locale/wstring_convert/wstring_convert + + (T... args) + + + T + from_bytes + cpp/locale/wstring_convert/from_bytes + + (T... args) + + + + std::greater_equal + cpp/utility/functional/greater_equal + + T + operator() + cpp/utility/functional/greater_equal + + (T... args) + + + + std::is_trivially_constructible + cpp/types/is_constructible + + + std::string + cpp/string/basic_string + + T + push_back + cpp/string/basic_string/push_back + + (T... args) + + + T + shrink_to_fit + cpp/string/basic_string/shrink_to_fit + + (T... args) + + + T + rfind + cpp/string/basic_string/rfind + + (T... args) + + + T + begin + cpp/string/basic_string/begin + + (T... args) + + + T + erase + cpp/string/basic_string/erase + + (T... args) + + + T + append + cpp/string/basic_string/append + + (T... args) + + + T + data + cpp/string/basic_string/data + + (T... args) + + + T + insert + cpp/string/basic_string/insert + + (T... args) + + + T + assign + cpp/string/basic_string/assign + + (T... args) + + + T + find_first_not_of + cpp/string/basic_string/find_first_not_of + + (T... args) + + + T + back + cpp/string/basic_string/back + + (T... args) + + + T + end + cpp/string/basic_string/end + + (T... args) + + + T + resize + cpp/string/basic_string/resize + + (T... args) + + + T + copy + cpp/string/basic_string/copy + + (T... args) + + + T + find_last_of + cpp/string/basic_string/find_last_of + + (T... args) + + + T + pop_back + cpp/string/basic_string/pop_back + + (T... args) + + + T + replace + cpp/string/basic_string/replace + + (T... args) + + + T + front + cpp/string/basic_string/front + + (T... args) + + + T + substr + cpp/string/basic_string/substr + + (T... args) + + + T + find + cpp/string/basic_string/find + + (T... args) + + + T + compare + cpp/string/basic_string/compare + + (T... args) + + + T + crbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + cbegin + cpp/string/basic_string/begin + + (T... args) + + + T + find_first_of + cpp/string/basic_string/find_first_of + + (T... args) + + + T + rbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + crend + cpp/string/basic_string/rend + + (T... args) + + + T + size + cpp/string/basic_string/size + + (T... args) + + + T + operator= + cpp/string/basic_string/operator= + + (T... args) + + + T + find_last_not_of + cpp/string/basic_string/find_last_not_of + + (T... args) + + + T + reserve + cpp/string/basic_string/reserve + + (T... args) + + + T + capacity + cpp/string/basic_string/capacity + + (T... args) + + + T + c_str + cpp/string/basic_string/c_str + + (T... args) + + + T + empty + cpp/string/basic_string/empty + + (T... args) + + + T + cend + cpp/string/basic_string/end + + (T... args) + + + T + string + cpp/string/basic_string/basic_string + + (T... args) + + + T + max_size + cpp/string/basic_string/max_size + + (T... args) + + + T + rend + cpp/string/basic_string/rend + + (T... args) + + + T + get_allocator + cpp/string/basic_string/get_allocator + + (T... args) + + + T + clear + cpp/string/basic_string/clear + + (T... args) + + + T + at + cpp/string/basic_string/at + + (T... args) + + + T + swap + cpp/string/basic_string/swap + + (T... args) + + + T + operator[] + cpp/string/basic_string/operator_at + + (T... args) + + + T + length + cpp/string/basic_string/size + + (T... args) + + + + std::discrete_distribution + cpp/numeric/random/discrete_distribution + + T + probabilities + cpp/numeric/random/discrete_distribution/probabilities + + (T... args) + + + T + reset + cpp/numeric/random/discrete_distribution/reset + + (T... args) + + + T + operator() + cpp/numeric/random/discrete_distribution/operator() + + (T... args) + + + T + discrete_distribution + cpp/numeric/random/discrete_distribution/discrete_distribution + + (T... args) + + + T + max + cpp/numeric/random/discrete_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/discrete_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/discrete_distribution/min + + (T... args) + + + + std::wostream + cpp/io/basic_ostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + std::wostream::event_callback + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + ~wostream + cpp/io/basic_ostream/~basic_ostream + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + wostream + cpp/io/basic_ostream/basic_ostream + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + std::wostream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wostream::event_callback + cpp/io/ios_base/event_callback + + + std::wostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::is_polymorphic + cpp/types/is_polymorphic + + + std::reverse_iterator + cpp/iterator/reverse_iterator + + + std::bad_array_new_length + cpp/memory/new/bad_array_new_length + + T + bad_array_new_length + cpp/memory/new/bad_array_new_length/bad_array_new_length + + (T... args) + + + T + what + cpp/memory/new/bad_alloc + + (T... args) + + + + std::condition_variable + cpp/thread/condition_variable + + T + wait + cpp/thread/condition_variable/wait + + (T... args) + + + T + notify_one + cpp/thread/condition_variable/notify_one + + (T... args) + + + T + wait_for + cpp/thread/condition_variable/wait_for + + (T... args) + + + T + notify_all + cpp/thread/condition_variable/notify_all + + (T... args) + + + T + native_handle + cpp/thread/condition_variable/native_handle + + (T... args) + + + T + wait_until + cpp/thread/condition_variable/wait_until + + (T... args) + + + T + condition_variable + cpp/thread/condition_variable/condition_variable + + (T... args) + + + T + ~condition_variable + cpp/thread/condition_variable/~condition_variable + + (T... args) + + + + std::ranlux48 + cpp/numeric/random/discard_block_engine + + T + discard + cpp/numeric/random/discard_block_engine/discard + + (T... args) + + + T + operator() + cpp/numeric/random/discard_block_engine/operator() + + (T... args) + + + T + ranlux48 + cpp/numeric/random/discard_block_engine/discard_block_engine + + (T... args) + + + T + base + cpp/numeric/random/discard_block_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/discard_block_engine/seed + + (T... args) + + + T + max + cpp/numeric/random/discard_block_engine/max + + (T... args) + + + T + min + cpp/numeric/random/discard_block_engine/min + + (T... args) + + + + std::unexpected_handler + cpp/error/unexpected_handler + + + std::piecewise_constant_distribution + cpp/numeric/random/piecewise_constant_distribution + + T + densities + cpp/numeric/random/piecewise_constant_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/piecewise_constant_distribution/max + + (T... args) + + + T + intervals + cpp/numeric/random/piecewise_constant_distribution/params + + (T... args) + + + T + reset + cpp/numeric/random/piecewise_constant_distribution/reset + + (T... args) + + + T + piecewise_constant_distribution + cpp/numeric/random/piecewise_constant_distribution/piecewise_constant_distribution + + (T... args) + + + T + operator() + cpp/numeric/random/piecewise_constant_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/piecewise_constant_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/piecewise_constant_distribution/min + + (T... args) + + + + std::codecvt_base + cpp/locale/codecvt_base + + + std::set + cpp/container/set + + T + begin + cpp/container/set/begin + + (T... args) + + + T + erase + cpp/container/set/erase + + (T... args) + + + T + insert + cpp/container/set/insert + + (T... args) + + + T + ~set + cpp/container/set/~set + + (T... args) + + + T + rbegin + cpp/container/set/rbegin + + (T... args) + + + T + end + cpp/container/set/end + + (T... args) + + + T + emplace_hint + cpp/container/set/emplace_hint + + (T... args) + + + T + key_comp + cpp/container/set/key_comp + + (T... args) + + + T + count + cpp/container/set/count + + (T... args) + + + T + find + cpp/container/set/find + + (T... args) + + + T + crbegin + cpp/container/set/rbegin + + (T... args) + + + T + cbegin + cpp/container/set/begin + + (T... args) + + + T + upper_bound + cpp/container/set/upper_bound + + (T... args) + + + T + swap + cpp/container/set/swap + + (T... args) + + + T + crend + cpp/container/set/rend + + (T... args) + + + T + size + cpp/container/set/size + + (T... args) + + + T + set + cpp/container/set/set + + (T... args) + + + T + operator= + cpp/container/set/operator= + + (T... args) + + + T + value_comp + cpp/container/set/value_comp + + (T... args) + + + T + empty + cpp/container/set/empty + + (T... args) + + + T + lower_bound + cpp/container/set/lower_bound + + (T... args) + + + T + get_allocator + cpp/container/set/get_allocator + + (T... args) + + + T + max_size + cpp/container/set/max_size + + (T... args) + + + T + rend + cpp/container/set/rend + + (T... args) + + + T + cend + cpp/container/set/end + + (T... args) + + + T + clear + cpp/container/set/clear + + (T... args) + + + T + equal_range + cpp/container/set/equal_range + + (T... args) + + + T + emplace + cpp/container/set/emplace + + (T... args) + + + + std::forward_iterator_tag + cpp/iterator/iterator_tags + + + std::codecvt_byname + cpp/locale/codecvt_byname + std::codecvt_byname::extern_type + + T + out + cpp/locale/codecvt/out + + (T... args) + + + T + do_length + cpp/locale/codecvt/length + + (T... args) + + + T + do_unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + do_encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + do_in + cpp/locale/codecvt/in + + (T... args) + + + T + unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + max_length + cpp/locale/codecvt/max_length + + (T... args) + + std::codecvt_byname::state_type + + T + encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + do_out + cpp/locale/codecvt/out + + (T... args) + + + T + codecvt_byname + cpp/locale/codecvt_byname + + (T... args) + + + T + do_max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + do_always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + in + cpp/locale/codecvt/in + + (T... args) + + std::codecvt_byname::intern_type + + T + length + cpp/locale/codecvt/length + + (T... args) + + + T + ~codecvt_byname + cpp/locale/codecvt_byname + + (T... args) + + + + std::codecvt_byname::extern_type + cpp/locale/codecvt + + + std::codecvt_byname::state_type + cpp/locale/codecvt + + + std::codecvt_byname::intern_type + cpp/locale/codecvt + + + std::pointer_safety + cpp/memory/gc/pointer_safety + + + std::uint_least64_t + cpp/types/integer + + + std::placeholders + cpp/utility/functional/placeholders + + + std::nothrow_t + cpp/memory/new/nothrow_t + + + std::is_nothrow_copy_assignable + cpp/types/is_copy_assignable + + + std::is_same + cpp/types/is_same + + + std::unique_lock + cpp/thread/unique_lock + + T + mutex + cpp/thread/unique_lock/mutex + + (T... args) + + + T + swap + cpp/thread/unique_lock/swap + + (T... args) + + + T + owns_lock + cpp/thread/unique_lock/owns_lock + + (T... args) + + + T + try_lock_for + cpp/thread/unique_lock/try_lock_for + + (T... args) + + + T + release + cpp/thread/unique_lock/release + + (T... args) + + + T + lock + cpp/thread/unique_lock/lock + + (T... args) + + + T + operator bool + cpp/thread/unique_lock/operator_bool + + (T... args) + + + T + ~unique_lock + cpp/thread/unique_lock/~unique_lock + + (T... args) + + + T + unlock + cpp/thread/unique_lock/unlock + + (T... args) + + + T + operator= + cpp/thread/unique_lock/operator= + + (T... args) + + + T + try_lock_until + cpp/thread/unique_lock/try_lock_until + + (T... args) + + + T + try_lock + cpp/thread/unique_lock/try_lock + + (T... args) + + + T + unique_lock + cpp/thread/unique_lock/unique_lock + + (T... args) + + + + std::basic_ostringstream + cpp/io/basic_ostringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_ostringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::basic_ostringstream::event_callback + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_ostringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + operator= + cpp/io/basic_ostringstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + basic_ostringstream + cpp/io/basic_ostringstream/basic_ostringstream + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::basic_ostringstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_ostringstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_ostringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_ostringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::is_error_code_enum + cpp/error/error_code/is_error_code_enum + + + std::time_put_byname + cpp/locale/time_put_byname + + T + time_put_byname + cpp/locale/time_put_byname + + (T... args) + + std::time_put_byname::char_type + + T + do_put + cpp/locale/time_put/put + + (T... args) + + + T + put + cpp/locale/time_put/put + + (T... args) + + + T + ~time_put_byname + cpp/locale/time_put_byname + + (T... args) + + std::time_put_byname::iter_type + + + std::time_put_byname::char_type + cpp/locale/time_put + + + std::time_put_byname::iter_type + cpp/locale/time_put + + + std::time_get + cpp/locale/time_get + + T + do_date_order + cpp/locale/time_get/date_order + + (T... args) + + + T + do_get + cpp/locale/time_get/get + + (T... args) + + + T + do_get_monthname + cpp/locale/time_get/get_monthname + + (T... args) + + + T + get_weekday + cpp/locale/time_get/get_weekday + + (T... args) + + + T + do_get_time + cpp/locale/time_get/get_time + + (T... args) + + + T + ~time_get + cpp/locale/time_get/~time_get + + (T... args) + + + T + do_get_year + cpp/locale/time_get/get_year + + (T... args) + + std::time_get::iter_type + + T + get_monthname + cpp/locale/time_get/get_monthname + + (T... args) + + + T + get_time + cpp/locale/time_get/get_time + + (T... args) + + + T + time_get + cpp/locale/time_get/time_get + + (T... args) + + + T + do_get_date + cpp/locale/time_get/get_date + + (T... args) + + + T + get_date + cpp/locale/time_get/get_date + + (T... args) + + std::time_get::char_type + + T + date_order + cpp/locale/time_get/date_order + + (T... args) + + + T + get_year + cpp/locale/time_get/get_year + + (T... args) + + + T + get + cpp/locale/time_get/get + + (T... args) + + + T + do_get_weekday + cpp/locale/time_get/get_weekday + + (T... args) + + + + std::time_get::iter_type + cpp/locale/time_get + + + std::time_get::char_type + cpp/locale/time_get + + + std::regex + cpp/regex/basic_regex + + T + operator= + cpp/regex/basic_regex/operator= + + (T... args) + + + T + swap + cpp/regex/basic_regex/swap + + (T... args) + + + T + imbue + cpp/regex/basic_regex/imbue + + (T... args) + + + T + assign + cpp/regex/basic_regex/assign + + (T... args) + + + T + regex + cpp/regex/basic_regex/basic_regex + + (T... args) + + + T + mark_count + cpp/regex/basic_regex/mark_count + + (T... args) + + + T + getloc + cpp/regex/basic_regex/getloc + + (T... args) + + + T + flags + cpp/regex/basic_regex/flags + + (T... args) + + + T + ~regex + cpp/regex/basic_regex/~basic_regex + + (T... args) + + + + std::cin + cpp/io/basic_istream + + + std::unordered_map + cpp/container/unordered_map + + T + max_bucket_count + cpp/container/unordered_map/max_bucket_count + + (T... args) + + + T + cbegin + cpp/container/unordered_map/begin + + (T... args) + + + T + erase + cpp/container/unordered_map/erase + + (T... args) + + + T + insert + cpp/container/unordered_map/insert + + (T... args) + + + T + bucket_count + cpp/container/unordered_map/bucket_count + + (T... args) + + + T + max_load_factor + cpp/container/unordered_map/max_load_factor + + (T... args) + + + T + end + cpp/container/unordered_map/end + + (T... args) + + + T + emplace_hint + cpp/container/unordered_map/emplace_hint + + (T... args) + + + T + end(int) + cpp/container/unordered_map/end2 + + (T... args) + + + T + load_factor + cpp/container/unordered_map/load_factor + + (T... args) + + + T + get_allocator + cpp/container/unordered_map/get_allocator + + (T... args) + + + T + key_eq + cpp/container/unordered_map/key_eq + + (T... args) + + + T + ~unordered_map + cpp/container/unordered_map/~unordered_map + + (T... args) + + + T + hash_function + cpp/container/unordered_map/hash_function + + (T... args) + + + T + find + cpp/container/unordered_map/find + + (T... args) + + + T + at + cpp/container/unordered_map/at + + (T... args) + + + T + cbegin(int) + cpp/container/unordered_map/begin2 + + (T... args) + + + T + swap + cpp/container/unordered_map/swap + + (T... args) + + + T + begin(int) + cpp/container/unordered_map/begin2 + + (T... args) + + + T + unordered_map + cpp/container/unordered_map/unordered_map + + (T... args) + + + T + size + cpp/container/unordered_map/size + + (T... args) + + + T + operator= + cpp/container/unordered_map/operator= + + (T... args) + + + T + cend(int) + cpp/container/unordered_map/end2 + + (T... args) + + + T + reserve + cpp/container/unordered_map/reserve + + (T... args) + + + T + rehash + cpp/container/unordered_map/rehash + + (T... args) + + + T + bucket + cpp/container/unordered_map/bucket + + (T... args) + + + T + empty + cpp/container/unordered_map/empty + + (T... args) + + + T + cend + cpp/container/unordered_map/end + + (T... args) + + + T + max_size + cpp/container/unordered_map/max_size + + (T... args) + + + T + count + cpp/container/unordered_map/count + + (T... args) + + + T + clear + cpp/container/unordered_map/clear + + (T... args) + + + T + equal_range + cpp/container/unordered_map/equal_range + + (T... args) + + + T + emplace + cpp/container/unordered_map/emplace + + (T... args) + + + T + operator[] + cpp/container/unordered_map/operator_at + + (T... args) + + + T + begin + cpp/container/unordered_map/begin + + (T... args) + + + T + bucket_size + cpp/container/unordered_map/bucket_size + + (T... args) + + + + std::initializer_list + cpp/utility/initializer_list + + T + end + cpp/utility/initializer_list/end + + (T... args) + + + T + size + cpp/utility/initializer_list/size + + (T... args) + + + T + initializer_list + cpp/utility/initializer_list/initializer_list + + (T... args) + + + T + begin + cpp/utility/initializer_list/begin + + (T... args) + + + + std::is_const + cpp/types/is_const + + + std::basic_regex + cpp/regex/basic_regex + + T + basic_regex + cpp/regex/basic_regex/basic_regex + + (T... args) + + + T + operator= + cpp/regex/basic_regex/operator= + + (T... args) + + + T + swap + cpp/regex/basic_regex/swap + + (T... args) + + + T + assign + cpp/regex/basic_regex/assign + + (T... args) + + + T + ~basic_regex + cpp/regex/basic_regex/~basic_regex + + (T... args) + + + T + getloc + cpp/regex/basic_regex/getloc + + (T... args) + + + T + mark_count + cpp/regex/basic_regex/mark_count + + (T... args) + + + T + imbue + cpp/regex/basic_regex/imbue + + (T... args) + + + T + flags + cpp/regex/basic_regex/flags + + (T... args) + + + + std::poisson_distribution + cpp/numeric/random/poisson_distribution + + T + poisson_distribution + cpp/numeric/random/poisson_distribution/poisson_distribution + + (T... args) + + + T + mean + cpp/numeric/random/poisson_distribution/mean + + (T... args) + + + T + max + cpp/numeric/random/poisson_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/poisson_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/poisson_distribution/min + + (T... args) + + + T + reset + cpp/numeric/random/poisson_distribution/reset + + (T... args) + + + + std::bad_typeid + cpp/types/bad_typeid + + T + bad_typeid + cpp/types/bad_typeid/bad_typeid + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::less_equal + cpp/utility/functional/less_equal + + T + operator() + cpp/utility/functional/less_equal + + (T... args) + + + + std::sig_atomic_t + cpp/utility/program/sig_atomic_t + + + std::make_unsigned + cpp/types/make_unsigned + + + std::basic_filebuf + cpp/io/basic_filebuf + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + basic_filebuf + cpp/io/basic_filebuf/basic_filebuf + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + is_open + cpp/io/basic_filebuf/is_open + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + ~basic_filebuf + cpp/io/basic_filebuf/~basic_filebuf + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + close + cpp/io/basic_filebuf/close + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + open + cpp/io/basic_filebuf/open + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + operator= + cpp/io/basic_filebuf/operator= + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + + std::logical_or + cpp/utility/functional/logical_or + + T + operator() + cpp/utility/functional/logical_or + + (T... args) + + + + std::wstringbuf + cpp/io/basic_stringbuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + str + cpp/io/basic_stringbuf/str + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + operator= + cpp/io/basic_stringbuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + wstringbuf + cpp/io/basic_stringbuf/basic_stringbuf + + (T... args) + + + + std::kilo + cpp/numeric/ratio/ratio + + + std::bernoulli_distribution + cpp/numeric/random/bernoulli_distribution + + T + bernoulli_distribution + cpp/numeric/random/bernoulli_distribution/bernoulli_distribution + + (T... args) + + + T + p + cpp/numeric/random/bernoulli_distribution/p + + (T... args) + + + T + reset + cpp/numeric/random/bernoulli_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/bernoulli_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/bernoulli_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/bernoulli_distribution/min + + (T... args) + + + + std::int16_t + cpp/types/integer + + + std::basic_ios + cpp/io/basic_ios + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + imbue + cpp/io/ios_base/imbue + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + std::basic_ios::failure + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + basic_ios + cpp/io/basic_ios/basic_ios + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + ~basic_ios + cpp/io/basic_ios/~basic_ios + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + std::basic_ios::event_callback + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_ios::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_ios::event_callback + cpp/io/ios_base/event_callback + + + std::int32_t + cpp/types/integer + + + std::is_rvalue_reference + cpp/types/is_rvalue_reference + + + std::integral_constant + cpp/types/integral_constant + + + std::wsmatch + cpp/regex/match_results + + T + cbegin + cpp/regex/match_results/begin + + (T... args) + + + T + format + cpp/regex/match_results/format + + (T... args) + + + T + wsmatch + cpp/regex/match_results/match_results + + (T... args) + + + T + size + cpp/regex/match_results/size + + (T... args) + + + T + swap + cpp/regex/match_results/swap + + (T... args) + + + T + position + cpp/regex/match_results/position + + (T... args) + + + T + prefix + cpp/regex/match_results/prefix + + (T... args) + + + T + str + cpp/regex/match_results/str + + (T... args) + + + T + ~wsmatch + cpp/regex/match_results/~match_results + + (T... args) + + + T + empty + cpp/regex/match_results/empty + + (T... args) + + + T + suffix + cpp/regex/match_results/suffix + + (T... args) + + + T + get_allocator + cpp/regex/match_results/get_allocator + + (T... args) + + + T + end + cpp/regex/match_results/end + + (T... args) + + + T + max_size + cpp/regex/match_results/max_size + + (T... args) + + + T + ready + cpp/regex/match_results/ready + + (T... args) + + + T + cend + cpp/regex/match_results/end + + (T... args) + + + T + operator[] + cpp/regex/match_results/operator_at + + (T... args) + + + T + length + cpp/regex/match_results/length + + (T... args) + + + T + begin + cpp/regex/match_results/begin + + (T... args) + + + + std::cerr + cpp/io/basic_ostream + + + std::codecvt_utf8 + cpp/locale/codecvt_utf8 + std::codecvt_utf8::extern_type + + T + out + cpp/locale/codecvt/out + + (T... args) + + + T + do_length + cpp/locale/codecvt/length + + (T... args) + + + T + do_unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + do_encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + do_in + cpp/locale/codecvt/in + + (T... args) + + + T + unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + max_length + cpp/locale/codecvt/max_length + + (T... args) + + std::codecvt_utf8::state_type + + T + encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + do_out + cpp/locale/codecvt/out + + (T... args) + + + T + do_max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + do_always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + in + cpp/locale/codecvt/in + + (T... args) + + std::codecvt_utf8::intern_type + + T + length + cpp/locale/codecvt/length + + (T... args) + + + + std::codecvt_utf8::extern_type + cpp/locale/codecvt + + + std::codecvt_utf8::state_type + cpp/locale/codecvt + + + std::codecvt_utf8::intern_type + cpp/locale/codecvt + + + std::ratio_add + cpp/numeric/ratio/ratio_add + + + std::is_trivially_move_constructible + cpp/types/is_move_constructible + + + std::wcsub_match + cpp/regex/sub_match + + T + operator string_type + cpp/regex/sub_match/str + + (T... args) + + + T + wcsub_match + cpp/regex/sub_match/sub_match + + (T... args) + + + T + str + cpp/regex/sub_match/str + + (T... args) + + + T + length + cpp/regex/sub_match/length + + (T... args) + + + T + compare + cpp/regex/sub_match/compare + + (T... args) + + + + std::is_member_pointer + cpp/types/is_member_pointer + + + std::wstreampos + cpp/io/fpos + + T + state + cpp/io/fpos/state + + (T... args) + + + + std::uint_least16_t + cpp/types/integer + + + std::tuple + cpp/utility/tuple + + T + operator= + cpp/utility/tuple/operator= + + (T... args) + + + T + swap + cpp/utility/tuple/swap + + (T... args) + + + T + tuple + cpp/utility/tuple/tuple + + (T... args) + + + + std::make_signed + cpp/types/make_signed + + + std::logic_error + cpp/error/logic_error + + T + logic_error + cpp/error/logic_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::sregex_iterator + cpp/regex/regex_iterator + + T + operator!= + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + T + sregex_iterator + cpp/regex/regex_iterator/regex_iterator + + (T... args) + + + T + operator* + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + + std::int_least64_t + cpp/types/integer + + + std::binary_negate + cpp/utility/functional/binary_negate + + T + operator() + cpp/utility/functional/binary_negate + + (T... args) + + + T + binary_negate + cpp/utility/functional/binary_negate + + (T... args) + + + + std::discard_block_engine + cpp/numeric/random/discard_block_engine + + T + discard + cpp/numeric/random/discard_block_engine/discard + + (T... args) + + + T + max + cpp/numeric/random/discard_block_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/discard_block_engine/operator() + + (T... args) + + + T + base + cpp/numeric/random/discard_block_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/discard_block_engine/seed + + (T... args) + + + T + discard_block_engine + cpp/numeric/random/discard_block_engine/discard_block_engine + + (T... args) + + + T + min + cpp/numeric/random/discard_block_engine/min + + (T... args) + + + + std::is_trivially_assignable + cpp/types/is_assignable + + + std::add_cv + cpp/types/add_cv + + + std::pico + cpp/numeric/ratio/ratio + + + std::iterator_traits + cpp/iterator/iterator_traits + + + std::is_trivially_default_constructible + cpp/types/is_default_constructible + + + std::shared_ptr + cpp/memory/shared_ptr + + T + shared_ptr + cpp/memory/shared_ptr/shared_ptr + + (T... args) + + + T + ~shared_ptr + cpp/memory/shared_ptr/~shared_ptr + + (T... args) + + + T + swap + cpp/memory/shared_ptr/swap + + (T... args) + + + T + owner_before + cpp/memory/shared_ptr/owner_before + + (T... args) + + + T + reset + cpp/memory/shared_ptr/reset + + (T... args) + + + T + operator-> + cpp/memory/shared_ptr/operator* + + (T... args) + + + T + operator= + cpp/memory/shared_ptr/operator= + + (T... args) + + + T + unique + cpp/memory/shared_ptr/unique + + (T... args) + + + T + operator* + cpp/memory/shared_ptr/operator* + + (T... args) + + + T + operator bool + cpp/memory/shared_ptr/operator_bool + + (T... args) + + + T + get + cpp/memory/shared_ptr/get + + (T... args) + + + + std::bad_alloc + cpp/memory/new/bad_alloc + + T + operator= + cpp/memory/new/bad_alloc + + (T... args) + + + T + bad_alloc + cpp/memory/new/bad_alloc + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ostringstream + cpp/io/basic_ostringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_ostringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::ostringstream::event_callback + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + ostringstream + cpp/io/basic_ostringstream/basic_ostringstream + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::ostringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + operator= + cpp/io/basic_ostringstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::ostringstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::ostringstream::event_callback + cpp/io/ios_base/event_callback + + + std::ostringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ostringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::basic_fstream + cpp/io/basic_fstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + basic_fstream + cpp/io/basic_fstream/basic_fstream + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + open + cpp/io/basic_fstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::basic_fstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::basic_fstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + close + cpp/io/basic_fstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_fstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_fstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_fstream/operator= + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_fstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::basic_fstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_fstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::stringbuf + cpp/io/basic_stringbuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + stringbuf + cpp/io/basic_stringbuf/basic_stringbuf + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + str + cpp/io/basic_stringbuf/str + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + operator= + cpp/io/basic_stringbuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + + std::exponential_distribution + cpp/numeric/random/exponential_distribution + + T + exponential_distribution + cpp/numeric/random/exponential_distribution/exponential_distribution + + (T... args) + + + T + min + cpp/numeric/random/exponential_distribution/min + + (T... args) + + + T + max + cpp/numeric/random/exponential_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/exponential_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/exponential_distribution/param + + (T... args) + + + T + reset + cpp/numeric/random/exponential_distribution/reset + + (T... args) + + + T + lambda + cpp/numeric/random/exponential_distribution/lambda + + (T... args) + + + + std::uint32_t + cpp/types/integer + + + std::wcregex_iterator + cpp/regex/regex_iterator + + T + operator!= + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + wcregex_iterator + cpp/regex/regex_iterator/regex_iterator + + (T... args) + + + T + operator++(int) + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + + std::bad_function_call + cpp/utility/functional/bad_function_call + + T + bad_function_call + cpp/utility/functional/bad_function_call + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::false_type + cpp/types/integral_constant + + + std::wregex + cpp/regex/basic_regex + + T + wregex + cpp/regex/basic_regex/basic_regex + + (T... args) + + + T + swap + cpp/regex/basic_regex/swap + + (T... args) + + + T + imbue + cpp/regex/basic_regex/imbue + + (T... args) + + + T + assign + cpp/regex/basic_regex/assign + + (T... args) + + + T + ~wregex + cpp/regex/basic_regex/~basic_regex + + (T... args) + + + T + operator= + cpp/regex/basic_regex/operator= + + (T... args) + + + T + mark_count + cpp/regex/basic_regex/mark_count + + (T... args) + + + T + getloc + cpp/regex/basic_regex/getloc + + (T... args) + + + T + flags + cpp/regex/basic_regex/flags + + (T... args) + + + + std::uint_least8_t + cpp/types/integer + + + std::uniform_real_distribution + cpp/numeric/random/uniform_real_distribution + + T + uniform_real_distribution + cpp/numeric/random/uniform_real_distribution/uniform_real_distribution + + (T... args) + + + T + reset + cpp/numeric/random/uniform_real_distribution/reset + + (T... args) + + + T + a + cpp/numeric/random/uniform_real_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/uniform_real_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/uniform_real_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/uniform_real_distribution/min + + (T... args) + + + T + b + cpp/numeric/random/uniform_real_distribution/params + + (T... args) + + + + std::smatch + cpp/regex/match_results + + T + smatch + cpp/regex/match_results/match_results + + (T... args) + + + T + cbegin + cpp/regex/match_results/begin + + (T... args) + + + T + format + cpp/regex/match_results/format + + (T... args) + + + T + size + cpp/regex/match_results/size + + (T... args) + + + T + swap + cpp/regex/match_results/swap + + (T... args) + + + T + position + cpp/regex/match_results/position + + (T... args) + + + T + ~smatch + cpp/regex/match_results/~match_results + + (T... args) + + + T + prefix + cpp/regex/match_results/prefix + + (T... args) + + + T + str + cpp/regex/match_results/str + + (T... args) + + + T + empty + cpp/regex/match_results/empty + + (T... args) + + + T + suffix + cpp/regex/match_results/suffix + + (T... args) + + + T + get_allocator + cpp/regex/match_results/get_allocator + + (T... args) + + + T + end + cpp/regex/match_results/end + + (T... args) + + + T + max_size + cpp/regex/match_results/max_size + + (T... args) + + + T + ready + cpp/regex/match_results/ready + + (T... args) + + + T + cend + cpp/regex/match_results/end + + (T... args) + + + T + operator[] + cpp/regex/match_results/operator_at + + (T... args) + + + T + length + cpp/regex/match_results/length + + (T... args) + + + T + begin + cpp/regex/match_results/begin + + (T... args) + + + + std::cregex_token_iterator + cpp/regex/regex_token_iterator + + T + operator!= + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_token_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + cregex_token_iterator + cpp/regex/regex_token_iterator/regex_token_iterator + + (T... args) + + + T + operator++ + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + + std::range_error + cpp/error/range_error + + T + range_error + cpp/error/range_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_assignable + cpp/types/is_assignable + + + std::is_copy_assignable + cpp/types/is_copy_assignable + + + std::invalid_argument + cpp/error/invalid_argument + + T + invalid_argument + cpp/error/invalid_argument + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_unsigned + cpp/types/is_unsigned + + + std::jmp_buf + cpp/utility/program/jmp_buf + + + std::is_class + cpp/types/is_class + + + std::geometric_distribution + cpp/numeric/random/geometric_distribution + + T + p + cpp/numeric/random/geometric_distribution/p + + (T... args) + + + T + reset + cpp/numeric/random/geometric_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/geometric_distribution/max + + (T... args) + + + T + geometric_distribution + cpp/numeric/random/geometric_distribution/geometric_distribution + + (T... args) + + + T + param + cpp/numeric/random/geometric_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/geometric_distribution/min + + (T... args) + + + + std::uint_fast8_t + cpp/types/integer + + + std::mersenne_twister_engine + cpp/numeric/random/mersenne_twister_engine + + T + discard + cpp/numeric/random/mersenne_twister_engine/discard + + (T... args) + + + T + max + cpp/numeric/random/mersenne_twister_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/mersenne_twister_engine/operator() + + (T... args) + + + T + mersenne_twister_engine + cpp/numeric/random/mersenne_twister_engine/mersenne_twister_engine + + (T... args) + + + T + seed + cpp/numeric/random/mersenne_twister_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/mersenne_twister_engine/min + + (T... args) + + + + std::is_arithmetic + cpp/types/is_arithmetic + + + std::negate + cpp/utility/functional/negate + + T + operator() + cpp/utility/functional/negate + + (T... args) + + + + std::try_to_lock_t + cpp/thread/lock_tag_t + + + std::wfilebuf + cpp/io/basic_filebuf + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + is_open + cpp/io/basic_filebuf/is_open + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + ~wfilebuf + cpp/io/basic_filebuf/~basic_filebuf + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + wfilebuf + cpp/io/basic_filebuf/basic_filebuf + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + close + cpp/io/basic_filebuf/close + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + open + cpp/io/basic_filebuf/open + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + operator= + cpp/io/basic_filebuf/operator= + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + + std::is_compound + cpp/types/is_compound + + + std::iostream + cpp/io/basic_iostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + ~iostream + cpp/io/basic_iostream/~basic_iostream + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::iostream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::iostream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::iostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + iostream + cpp/io/basic_iostream/basic_iostream + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::iostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::iostream::event_callback + cpp/io/ios_base/event_callback + + + std::iostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_object + cpp/types/is_object + + + std::recursive_mutex + cpp/thread/recursive_mutex + + T + unlock + cpp/thread/recursive_mutex/unlock + + (T... args) + + + T + native_handle + cpp/thread/recursive_mutex/native_handle + + (T... args) + + + T + recursive_mutex + cpp/thread/recursive_mutex/recursive_mutex + + (T... args) + + + T + lock + cpp/thread/recursive_mutex/lock + + (T... args) + + + T + try_lock + cpp/thread/recursive_mutex/try_lock + + (T... args) + + + + std::is_copy_constructible + cpp/types/is_copy_constructible + + + std::codecvt_utf8_utf16 + cpp/locale/codecvt_utf8_utf16 + std::codecvt_utf8_utf16::extern_type + + T + out + cpp/locale/codecvt/out + + (T... args) + + + T + do_length + cpp/locale/codecvt/length + + (T... args) + + + T + do_unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + do_encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + do_in + cpp/locale/codecvt/in + + (T... args) + + + T + unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + max_length + cpp/locale/codecvt/max_length + + (T... args) + + std::codecvt_utf8_utf16::state_type + + T + encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + do_out + cpp/locale/codecvt/out + + (T... args) + + + T + do_max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + do_always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + in + cpp/locale/codecvt/in + + (T... args) + + std::codecvt_utf8_utf16::intern_type + + T + length + cpp/locale/codecvt/length + + (T... args) + + + + std::codecvt_utf8_utf16::extern_type + cpp/locale/codecvt + + + std::codecvt_utf8_utf16::state_type + cpp/locale/codecvt + + + std::codecvt_utf8_utf16::intern_type + cpp/locale/codecvt + + + std::not_equal_to + cpp/utility/functional/not_equal_to + + T + operator() + cpp/utility/functional/not_equal_to + + (T... args) + + + + std::is_destructible + cpp/types/is_destructible + + + std::int_fast32_t + cpp/types/integer + + + std::rank + cpp/types/rank + + + std::milli + cpp/numeric/ratio/ratio + + + std::deci + cpp/numeric/ratio/ratio + + + std::add_lvalue_reference + cpp/types/add_reference + + + std::is_bind_expression + cpp/utility/functional/is_bind_expression + + + std::ios_base + cpp/io/ios_base + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + std::ios_base::event_callback + std::ios_base::failure + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + imbue + cpp/io/ios_base/imbue + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + ios_base + cpp/io/ios_base/ios_base + + (T... args) + + + T + ~ios_base + cpp/io/ios_base/~ios_base + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + + std::ios_base::event_callback + cpp/io/ios_base/event_callback + + + std::ios_base::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ratio_less + cpp/numeric/ratio/ratio_less + + + std::int64_t + cpp/types/integer + + + std::nullptr_t + cpp/types/nullptr_t + + + std::stack + cpp/container/stack + + T + operator= + cpp/container/stack/operator= + + (T... args) + + + T + swap + cpp/container/stack/swap + + (T... args) + + + T + size + cpp/container/stack/size + + (T... args) + + + T + empty + cpp/container/stack/empty + + (T... args) + + + T + pop + cpp/container/stack/pop + + (T... args) + + + T + emplace + cpp/container/stack/emplace + + (T... args) + + + T + ~stack + cpp/container/stack/~stack + + (T... args) + + + T + top + cpp/container/stack/top + + (T... args) + + + T + stack + cpp/container/stack/stack + + (T... args) + + + T + push + cpp/container/stack/push + + (T... args) + + + + std::uint_fast64_t + cpp/types/integer + + + std::is_reference + cpp/types/is_reference + + + std::ratio + cpp/numeric/ratio/ratio + + + std::shared_future + cpp/thread/shared_future + + T + ~shared_future + cpp/thread/shared_future/~shared_future + + (T... args) + + + T + operator= + cpp/thread/shared_future/operator= + + (T... args) + + + T + wait + cpp/thread/shared_future/wait + + (T... args) + + + T + wait_until + cpp/thread/shared_future/wait_until + + (T... args) + + + T + wait_for + cpp/thread/shared_future/wait_for + + (T... args) + + + T + shared_future + cpp/thread/shared_future/shared_future + + (T... args) + + + T + valid + cpp/thread/shared_future/valid + + (T... args) + + + T + get + cpp/thread/shared_future/get + + (T... args) + + + + std::u16streampos + cpp/io/fpos + + T + state + cpp/io/fpos/state + + (T... args) + + + + std::wistream + cpp/io/basic_istream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::wistream::event_callback + + T + wistream + cpp/io/basic_istream/basic_istream + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ~wistream + cpp/io/basic_istream/~basic_istream + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wistream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + std::wistream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wistream::event_callback + cpp/io/ios_base/event_callback + + + std::wistream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wistream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::aligned_storage + cpp/types/aligned_storage + + + std::wstreambuf + cpp/io/basic_streambuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + wstreambuf + cpp/io/basic_streambuf/basic_streambuf + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + ~wstreambuf + cpp/io/basic_streambuf/~basic_streambuf + + (T... args) + + + T + operator= + cpp/io/basic_streambuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + + std::binary_function + cpp/utility/functional/binary_function + + + std::out_of_range + cpp/error/out_of_range + + T + out_of_range + cpp/error/out_of_range + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::independent_bits_engine + cpp/numeric/random/independent_bits_engine + + T + discard + cpp/numeric/random/independent_bits_engine/discard + + (T... args) + + + T + max + cpp/numeric/random/independent_bits_engine/max + + (T... args) + + + T + independent_bits_engine + cpp/numeric/random/independent_bits_engine/independent_bits_engine + + (T... args) + + + T + operator() + cpp/numeric/random/independent_bits_engine/operator() + + (T... args) + + + T + base + cpp/numeric/random/independent_bits_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/independent_bits_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/independent_bits_engine/min + + (T... args) + + + + std::stringstream + cpp/io/basic_stringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_stringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + stringstream + cpp/io/basic_stringstream/basic_stringstream + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::stringstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::stringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::stringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_stringstream/operator= + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::stringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::stringstream::event_callback + cpp/io/ios_base/event_callback + + + std::stringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::tera + cpp/numeric/ratio/ratio + + + std::recursive_timed_mutex + cpp/thread/recursive_timed_mutex + + T + unlock + cpp/thread/recursive_timed_mutex/unlock + + (T... args) + + + T + native_handle + cpp/thread/recursive_timed_mutex/native_handle + + (T... args) + + + T + try_lock_until + cpp/thread/recursive_timed_mutex/try_lock_until + + (T... args) + + + T + try_lock_for + cpp/thread/recursive_timed_mutex/try_lock_for + + (T... args) + + + T + recursive_timed_mutex + cpp/thread/recursive_timed_mutex/recursive_timed_mutex + + (T... args) + + + T + lock + cpp/thread/recursive_timed_mutex/lock + + (T... args) + + + T + try_lock + cpp/thread/recursive_timed_mutex/try_lock + + (T... args) + + + + std::nano + cpp/numeric/ratio/ratio + + + std::unordered_multimap + cpp/container/unordered_multimap + + T + ~unordered_multimap + cpp/container/unordered_multimap/~unordered_multimap + + (T... args) + + + T + max_bucket_count + cpp/container/unordered_multimap/max_bucket_count + + (T... args) + + + T + bucket_count + cpp/container/unordered_multimap/bucket_count + + (T... args) + + + T + cbegin + cpp/container/unordered_multimap/begin + + (T... args) + + + T + erase + cpp/container/unordered_multimap/erase + + (T... args) + + + T + insert + cpp/container/unordered_multimap/insert + + (T... args) + + + T + unordered_multimap + cpp/container/unordered_multimap/unordered_multimap + + (T... args) + + + T + max_load_factor + cpp/container/unordered_multimap/max_load_factor + + (T... args) + + + T + end + cpp/container/unordered_multimap/end + + (T... args) + + + T + emplace_hint + cpp/container/unordered_multimap/emplace_hint + + (T... args) + + + T + end(int) + cpp/container/unordered_multimap/end2 + + (T... args) + + + T + key_eq + cpp/container/unordered_multimap/key_eq + + (T... args) + + + T + hash_function + cpp/container/unordered_multimap/hash_function + + (T... args) + + + T + find + cpp/container/unordered_multimap/find + + (T... args) + + + T + begin + cpp/container/unordered_multimap/begin + + (T... args) + + + T + cbegin(int) + cpp/container/unordered_multimap/begin2 + + (T... args) + + + T + swap + cpp/container/unordered_multimap/swap + + (T... args) + + + T + begin(int) + cpp/container/unordered_multimap/begin2 + + (T... args) + + + T + load_factor + cpp/container/unordered_multimap/load_factor + + (T... args) + + + T + size + cpp/container/unordered_multimap/size + + (T... args) + + + T + operator= + cpp/container/unordered_multimap/operator= + + (T... args) + + + T + cend + cpp/container/unordered_multimap/end + + (T... args) + + + T + reserve + cpp/container/unordered_multimap/reserve + + (T... args) + + + T + rehash + cpp/container/unordered_multimap/rehash + + (T... args) + + + T + bucket + cpp/container/unordered_multimap/bucket + + (T... args) + + + T + empty + cpp/container/unordered_multimap/empty + + (T... args) + + + T + get_allocator + cpp/container/unordered_multimap/get_allocator + + (T... args) + + + T + max_size + cpp/container/unordered_multimap/max_size + + (T... args) + + + T + cend(int) + cpp/container/unordered_multimap/end2 + + (T... args) + + + T + count + cpp/container/unordered_multimap/count + + (T... args) + + + T + clear + cpp/container/unordered_multimap/clear + + (T... args) + + + T + equal_range + cpp/container/unordered_multimap/equal_range + + (T... args) + + + T + emplace + cpp/container/unordered_multimap/emplace + + (T... args) + + + T + bucket_size + cpp/container/unordered_multimap/bucket_size + + (T... args) + + + + std::normal_distribution + cpp/numeric/random/normal_distribution + + T + min + cpp/numeric/random/normal_distribution/min + + (T... args) + + + T + stddev + cpp/numeric/random/normal_distribution/params + + (T... args) + + + T + reset + cpp/numeric/random/normal_distribution/reset + + (T... args) + + + T + mean + cpp/numeric/random/normal_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/normal_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/normal_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/normal_distribution/param + + (T... args) + + + T + normal_distribution + cpp/numeric/random/normal_distribution/normal_distribution + + (T... args) + + + + std::minstd_rand + cpp/numeric/random/linear_congruential_engine + + T + discard + cpp/numeric/random/linear_congruential_engine/discard + + (T... args) + + + T + minstd_rand + cpp/numeric/random/linear_congruential_engine/linear_congruential_engine + + (T... args) + + + T + max + cpp/numeric/random/linear_congruential_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/linear_congruential_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/linear_congruential_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/linear_congruential_engine/min + + (T... args) + + + + std::is_signed + cpp/types/is_signed + + + std::is_move_constructible + cpp/types/is_move_constructible + + + std::unique_ptr + cpp/memory/unique_ptr + + T + unique_ptr + cpp/memory/unique_ptr/unique_ptr + + (T... args) + + + T + operator= + cpp/memory/unique_ptr/operator= + + (T... args) + + + T + swap + cpp/memory/unique_ptr/swap + + (T... args) + + + T + operator* + cpp/memory/unique_ptr/operator* + + (T... args) + + + T + ~unique_ptr + cpp/memory/unique_ptr/~unique_ptr + + (T... args) + + + T + operator-> + cpp/memory/unique_ptr/operator* + + (T... args) + + + T + release + cpp/memory/unique_ptr/release + + (T... args) + + + T + get_deleter + cpp/memory/unique_ptr/get_deleter + + (T... args) + + + T + operator bool + cpp/memory/unique_ptr/operator_bool + + (T... args) + + + T + get + cpp/memory/unique_ptr/get + + (T... args) + + + T + reset + cpp/memory/unique_ptr/reset + + (T... args) + + + + std::is_nothrow_copy_constructible + cpp/types/is_copy_constructible + + + std::forward_list + cpp/container/forward_list + + T + pop_front + cpp/container/forward_list/pop_front + + (T... args) + + + T + unique + cpp/container/forward_list/unique + + (T... args) + + + T + sort + cpp/container/forward_list/sort + + (T... args) + + + T + cbegin + cpp/container/forward_list/begin + + (T... args) + + + T + splice_after + cpp/container/forward_list/splice_after + + (T... args) + + + T + reverse + cpp/container/forward_list/reverse + + (T... args) + + + T + remove_if + cpp/container/forward_list/remove + + (T... args) + + + T + end + cpp/container/forward_list/end + + (T... args) + + + T + remove + cpp/container/forward_list/remove + + (T... args) + + + T + push_front + cpp/container/forward_list/push_front + + (T... args) + + + T + emplace_after + cpp/container/forward_list/emplace_after + + (T... args) + + + T + get_allocator + cpp/container/forward_list/get_allocator + + (T... args) + + + T + front + cpp/container/forward_list/front + + (T... args) + + + T + begin + cpp/container/forward_list/begin + + (T... args) + + + T + resize + cpp/container/forward_list/resize + + (T... args) + + + T + emplace_front + cpp/container/forward_list/emplace_front + + (T... args) + + + T + swap + cpp/container/forward_list/swap + + (T... args) + + + T + erase_after + cpp/container/forward_list/erase_after + + (T... args) + + + T + assign + cpp/container/forward_list/assign + + (T... args) + + + T + forward_list + cpp/container/forward_list/forward_list + + (T... args) + + + T + ~forward_list + cpp/container/forward_list/~forward_list + + (T... args) + + + T + before_begin + cpp/container/forward_list/before_begin + + (T... args) + + + T + cbefore_begin + cpp/container/forward_list/before_begin + + (T... args) + + + T + merge + cpp/container/forward_list/merge + + (T... args) + + + T + operator= + cpp/container/forward_list/operator= + + (T... args) + + + T + insert_after + cpp/container/forward_list/insert_after + + (T... args) + + + T + empty + cpp/container/forward_list/empty + + (T... args) + + + T + max_size + cpp/container/forward_list/max_size + + (T... args) + + + T + cend + cpp/container/forward_list/end + + (T... args) + + + T + clear + cpp/container/forward_list/clear + + (T... args) + + + + std::errc + cpp/error/errc + + + std::lconv + cpp/locale/lconv + + + std::strstreambuf + cpp/io/strstreambuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + str + cpp/io/strstreambuf/str + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pcount + cpp/io/strstreambuf/pcount + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + ~strstreambuf + cpp/io/strstreambuf/~strstreambuf + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + freeze + cpp/io/strstreambuf/freeze + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + strstreambuf + cpp/io/strstreambuf/strstreambuf + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + + std::locale + cpp/locale/locale + + T + name + cpp/locale/locale/name + + (T... args) + + + T + combine + cpp/locale/locale/combine + + (T... args) + + + T + operator() + cpp/locale/locale/operator() + + (T... args) + + + T + classic + cpp/locale/locale/classic + + (T... args) + + + T + global + cpp/locale/locale/global + + (T... args) + + + T + operator!= + cpp/locale/locale/operator_cmp + + (T... args) + + + T + operator= + cpp/locale/locale/operator= + + (T... args) + + std::locale::facet + + T + operator== + cpp/locale/locale/operator_cmp + + (T... args) + + + T + locale + cpp/locale/locale/locale + + (T... args) + + std::locale::id + + T + ~locale + cpp/locale/locale/~locale + + (T... args) + + + + std::locale::facet + cpp/locale/locale/facet + + T + facet + cpp/locale/locale/facet/facet + + (T... args) + + + + std::locale::id + cpp/locale/locale/id + + T + id + cpp/locale/locale/id/id + + (T... args) + + + + std::equal_to + cpp/utility/functional/equal_to + + T + operator() + cpp/utility/functional/equal_to + + (T... args) + + + + std::divides + cpp/utility/functional/divides + + T + operator() + cpp/utility/functional/divides + + (T... args) + + + + std::collate_byname + cpp/locale/collate_byname + + T + hash + cpp/locale/collate/hash + + (T... args) + + + T + do_hash + cpp/locale/collate/hash + + (T... args) + + std::collate_byname::char_type + + T + do_transform + cpp/locale/collate/transform + + (T... args) + + + T + transform + cpp/locale/collate/transform + + (T... args) + + + T + do_compare + cpp/locale/collate/compare + + (T... args) + + + T + ~collate_byname + cpp/locale/collate_byname + + (T... args) + + std::collate_byname::string_type + + T + collate_byname + cpp/locale/collate_byname + + (T... args) + + + T + compare + cpp/locale/collate/compare + + (T... args) + + + + std::collate_byname::char_type + cpp/locale/collate + + + std::collate_byname::string_type + cpp/locale/collate + + + std::domain_error + cpp/error/domain_error + + T + domain_error + cpp/error/domain_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_empty + cpp/types/is_empty + + + std::is_nothrow_default_constructible + cpp/types/is_default_constructible + + + std::ratio_equal + cpp/numeric/ratio/ratio_equal + + + std::ostream + cpp/io/basic_ostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::ostream::event_callback + + T + ostream + cpp/io/basic_ostream/basic_ostream + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + ~ostream + cpp/io/basic_ostream/~basic_ostream + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::ostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + std::ostream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::ostream::event_callback + cpp/io/ios_base/event_callback + + + std::ostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::streamsize + cpp/io/streamsize + + + std::shared_lock + cpp/thread/shared_lock + + T + mutex + cpp/thread/shared_lock/mutex + + (T... args) + + + T + swap + cpp/thread/shared_lock/swap + + (T... args) + + + T + shared_lock + cpp/thread/shared_lock/shared_lock + + (T... args) + + + T + try_lock_for + cpp/thread/shared_lock/try_lock_for + + (T... args) + + + T + release + cpp/thread/shared_lock/release + + (T... args) + + + T + lock + cpp/thread/shared_lock/lock + + (T... args) + + + T + operator bool + cpp/thread/shared_lock/operator_bool + + (T... args) + + + T + unlock + cpp/thread/shared_lock/unlock + + (T... args) + + + T + operator= + cpp/thread/shared_lock/operator= + + (T... args) + + + T + ~shared_lock + cpp/thread/shared_lock/~shared_lock + + (T... args) + + + T + try_lock_until + cpp/thread/shared_lock/try_lock_until + + (T... args) + + + T + try_lock + cpp/thread/shared_lock/try_lock + + (T... args) + + + T + owns_lock + cpp/thread/shared_lock/owns_lock + + (T... args) + + + + std::uint8_t + cpp/types/integer + + + std::enable_shared_from_this + cpp/memory/enable_shared_from_this + + T + enable_shared_from_this + cpp/memory/enable_shared_from_this/enable_shared_from_this + + (T... args) + + + T + operator= + cpp/memory/enable_shared_from_this/operator= + + (T... args) + + + T + shared_from_this + cpp/memory/enable_shared_from_this/shared_from_this + + (T... args) + + + T + ~enable_shared_from_this + cpp/memory/enable_shared_from_this/~enable_shared_from_this + + (T... args) + + + + std::ptrdiff_t + cpp/types/ptrdiff_t + + + std::int_fast8_t + cpp/types/integer + + + std::aligned_union + cpp/types/aligned_union + + + std::future + cpp/thread/future + + T + operator= + cpp/thread/future/operator= + + (T... args) + + + T + wait + cpp/thread/future/wait + + (T... args) + + + T + wait_until + cpp/thread/future/wait_until + + (T... args) + + + T + wait_for + cpp/thread/future/wait_for + + (T... args) + + + T + ~future + cpp/thread/future/~future + + (T... args) + + + T + share + cpp/thread/future/share + + (T... args) + + + T + future + cpp/thread/future/future + + (T... args) + + + T + valid + cpp/thread/future/valid + + (T... args) + + + T + get + cpp/thread/future/get + + (T... args) + + + + std::wcmatch + cpp/regex/match_results + + T + wcmatch + cpp/regex/match_results/match_results + + (T... args) + + + T + cbegin + cpp/regex/match_results/begin + + (T... args) + + + T + format + cpp/regex/match_results/format + + (T... args) + + + T + size + cpp/regex/match_results/size + + (T... args) + + + T + swap + cpp/regex/match_results/swap + + (T... args) + + + T + position + cpp/regex/match_results/position + + (T... args) + + + T + prefix + cpp/regex/match_results/prefix + + (T... args) + + + T + str + cpp/regex/match_results/str + + (T... args) + + + T + empty + cpp/regex/match_results/empty + + (T... args) + + + T + suffix + cpp/regex/match_results/suffix + + (T... args) + + + T + get_allocator + cpp/regex/match_results/get_allocator + + (T... args) + + + T + end + cpp/regex/match_results/end + + (T... args) + + + T + max_size + cpp/regex/match_results/max_size + + (T... args) + + + T + ~wcmatch + cpp/regex/match_results/~match_results + + (T... args) + + + T + ready + cpp/regex/match_results/ready + + (T... args) + + + T + cend + cpp/regex/match_results/end + + (T... args) + + + T + operator[] + cpp/regex/match_results/operator_at + + (T... args) + + + T + length + cpp/regex/match_results/length + + (T... args) + + + T + begin + cpp/regex/match_results/begin + + (T... args) + + + + std::overflow_error + cpp/error/overflow_error + + T + overflow_error + cpp/error/overflow_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::centi + cpp/numeric/ratio/ratio + + + std::wssub_match + cpp/regex/sub_match + + T + operator string_type + cpp/regex/sub_match/str + + (T... args) + + + T + str + cpp/regex/sub_match/str + + (T... args) + + + T + wssub_match + cpp/regex/sub_match/sub_match + + (T... args) + + + T + length + cpp/regex/sub_match/length + + (T... args) + + + T + compare + cpp/regex/sub_match/compare + + (T... args) + + + + std::is_nothrow_move_assignable + cpp/types/is_move_assignable + + + std::pair + cpp/utility/pair + + T + pair + cpp/utility/pair/pair + + (T... args) + + + T + swap + cpp/utility/pair/swap + + (T... args) + + + T + operator= + cpp/utility/pair/operator= + + (T... args) + + + + std::wsregex_token_iterator + cpp/regex/regex_token_iterator + + T + operator!= + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_token_iterator/operator= + + (T... args) + + + T + wsregex_token_iterator + cpp/regex/regex_token_iterator/regex_token_iterator + + (T... args) + + + T + operator-> + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + operator== + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator* + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + + std::weibull_distribution + cpp/numeric/random/weibull_distribution + + T + reset + cpp/numeric/random/weibull_distribution/reset + + (T... args) + + + T + a + cpp/numeric/random/weibull_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/weibull_distribution/max + + (T... args) + + + T + weibull_distribution + cpp/numeric/random/weibull_distribution/weibull_distribution + + (T... args) + + + T + operator() + cpp/numeric/random/weibull_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/weibull_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/weibull_distribution/min + + (T... args) + + + T + b + cpp/numeric/random/weibull_distribution/params + + (T... args) + + + + std::less + cpp/utility/functional/less + + T + operator() + cpp/utility/functional/less + + (T... args) + + + + std::multiplies + cpp/utility/functional/multiplies + + T + operator() + cpp/utility/functional/multiplies + + (T... args) + + + + std::is_enum + cpp/types/is_enum + + + std::unary_function + cpp/utility/functional/unary_function + + + std::error_code + cpp/error/error_code + + T + value + cpp/error/error_code/value + + (T... args) + + + T + operator bool + cpp/error/error_code/operator_bool + + (T... args) + + + T + assign + cpp/error/error_code/assign + + (T... args) + + + T + operator= + cpp/error/error_code/operator= + + (T... args) + + + T + error_code + cpp/error/error_code/error_code + + (T... args) + + + T + clear + cpp/error/error_code/clear + + (T... args) + + + T + default_error_condition + cpp/error/error_code/default_error_condition + + (T... args) + + + T + message + cpp/error/error_code/message + + (T... args) + + + T + category + cpp/error/error_code/category + + (T... args) + + + + std::yocto + cpp/numeric/ratio/ratio + + + std::streampos + cpp/io/fpos + + T + state + cpp/io/fpos/state + + (T... args) + + + + std::istream_iterator + cpp/iterator/istream_iterator + + + std::wifstream + cpp/io/basic_ifstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + open + cpp/io/basic_ifstream/open + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + operator= + cpp/io/basic_ifstream/operator= + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::wifstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ifstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::wifstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ifstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + wifstream + cpp/io/basic_ifstream/basic_ifstream + + (T... args) + + std::wifstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wifstream::event_callback + cpp/io/ios_base/event_callback + + + std::wifstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wifstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::moneypunct_byname + cpp/locale/moneypunct_byname + + T + do_curr_symbol + cpp/locale/moneypunct/curr_symbol + + (T... args) + + + T + do_decimal_point + cpp/locale/moneypunct/decimal_point + + (T... args) + + + T + thousands_sep + cpp/locale/moneypunct/thousands_sep + + (T... args) + + + T + moneypunct_byname + cpp/locale/moneypunct_byname + + (T... args) + + + T + curr_symbol + cpp/locale/moneypunct/curr_symbol + + (T... args) + + + T + do_thousands_sep + cpp/locale/moneypunct/thousands_sep + + (T... args) + + + T + positive_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + frac_digits + cpp/locale/moneypunct/frac_digits + + (T... args) + + + T + do_negative_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + pos_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + do_pos_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + neg_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + negative_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + grouping + cpp/locale/moneypunct/grouping + + (T... args) + + + T + do_frac_digits + cpp/locale/moneypunct/frac_digits + + (T... args) + + + T + decimal_point + cpp/locale/moneypunct/decimal_point + + (T... args) + + + T + do_neg_format + cpp/locale/moneypunct/pos_format + + (T... args) + + std::moneypunct_byname::string_type + std::moneypunct_byname::pattern + + T + do_positive_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + std::moneypunct_byname::char_type + + T + ~moneypunct_byname + cpp/locale/moneypunct_byname + + (T... args) + + + T + do_grouping + cpp/locale/moneypunct/grouping + + (T... args) + + + + std::moneypunct_byname::string_type + cpp/locale/moneypunct + + + std::moneypunct_byname::pattern + cpp/locale/money_base + + + std::moneypunct_byname::char_type + cpp/locale/moneypunct + + + std::terminate_handler + cpp/error/terminate_handler + + + std::ctype_base + cpp/locale/ctype_base + std::ctype_base::mask + + + std::ctype_base::mask + cpp/locale/ctype_base + + + std::reference_wrapper + cpp/utility/functional/reference_wrapper + + T + operator= + cpp/utility/functional/reference_wrapper/operator= + + (T... args) + + + T + operator() + cpp/utility/functional/reference_wrapper/operator() + + (T... args) + + + T + get + cpp/utility/functional/reference_wrapper/get + + (T... args) + + + T + reference_wrapper + cpp/utility/functional/reference_wrapper/reference_wrapper + + (T... args) + + + T + operator T& + cpp/utility/functional/reference_wrapper/get + + (T... args) + + + + std::ranlux48_base + cpp/numeric/random/subtract_with_carry_engine + + T + discard + cpp/numeric/random/subtract_with_carry_engine/discard + + (T... args) + + + T + ranlux48_base + cpp/numeric/random/subtract_with_carry_engine/subtract_with_carry_engine + + (T... args) + + + T + max + cpp/numeric/random/subtract_with_carry_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/subtract_with_carry_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/subtract_with_carry_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/subtract_with_carry_engine/min + + (T... args) + + + + std::bit_not + cpp/utility/functional/bit_not + + T + operator() + cpp/utility/functional/bit_not + + (T... args) + + + + std::int_fast16_t + cpp/types/integer + + + std::error_category + cpp/error/error_category + + T + name + cpp/error/error_category/name + + (T... args) + + + T + operator!= + cpp/error/error_category/operator_cmp + + (T... args) + + + T + operator< + cpp/error/error_category/operator_cmp + + (T... args) + + + T + error_category + cpp/error/error_category/error_category + + (T... args) + + + T + equivalent + cpp/error/error_category/equivalent + + (T... args) + + + T + operator== + cpp/error/error_category/operator_cmp + + (T... args) + + + T + ~error_category + cpp/error/error_category/~error_category + + (T... args) + + + T + default_error_condition + cpp/error/error_category/default_error_condition + + (T... args) + + + T + message + cpp/error/error_category/message + + (T... args) + + + + std::regex_traits + cpp/regex/regex_traits + + T + value + cpp/regex/regex_traits/value + + (T... args) + + + T + lookup_collatename + cpp/regex/regex_traits/lookup_collatename + + (T... args) + + + T + isctype + cpp/regex/regex_traits/isctype + + (T... args) + + + T + getloc + cpp/regex/regex_traits/getloc + + (T... args) + + + T + regex_traits + cpp/regex/regex_traits/regex_traits + + (T... args) + + + T + transform_primary + cpp/regex/regex_traits/transform_primary + + (T... args) + + + T + translate + cpp/regex/regex_traits/translate + + (T... args) + + + T + imbue + cpp/regex/regex_traits/imbue + + (T... args) + + + T + lookup_classname + cpp/regex/regex_traits/lookup_classname + + (T... args) + + + T + transform + cpp/regex/regex_traits/transform + + (T... args) + + + T + length + cpp/regex/regex_traits/length + + (T... args) + + + T + translate_nocase + cpp/regex/regex_traits/translate_nocase + + (T... args) + + + + std::regex_constants + + + + std::negative_binomial_distribution + cpp/numeric/random/negative_binomial_distribution + + T + p + cpp/numeric/random/negative_binomial_distribution/params + + (T... args) + + + T + negative_binomial_distribution + cpp/numeric/random/negative_binomial_distribution/negative_binomial_distribution + + (T... args) + + + T + min + cpp/numeric/random/negative_binomial_distribution/min + + (T... args) + + + T + max + cpp/numeric/random/negative_binomial_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/negative_binomial_distribution/param + + (T... args) + + + T + reset + cpp/numeric/random/negative_binomial_distribution/reset + + (T... args) + + + T + k + cpp/numeric/random/negative_binomial_distribution/params + + (T... args) + + + + std::is_union + cpp/types/is_union + + + std::mt19937 + cpp/numeric/random/mersenne_twister_engine + + T + seed + cpp/numeric/random/mersenne_twister_engine/seed + + (T... args) + + + T + discard + cpp/numeric/random/mersenne_twister_engine/discard + + (T... args) + + + T + operator() + cpp/numeric/random/mersenne_twister_engine/operator() + + (T... args) + + + T + mt19937 + cpp/numeric/random/mersenne_twister_engine/mersenne_twister_engine + + (T... args) + + + T + max + cpp/numeric/random/mersenne_twister_engine/max + + (T... args) + + + T + min + cpp/numeric/random/mersenne_twister_engine/min + + (T... args) + + + + std::enable_if + cpp/types/enable_if + + + std::chi_squared_distribution + cpp/numeric/random/chi_squared_distribution + + T + n + cpp/numeric/random/chi_squared_distribution/n + + (T... args) + + + T + reset + cpp/numeric/random/chi_squared_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/chi_squared_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/chi_squared_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/chi_squared_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/chi_squared_distribution/min + + (T... args) + + + T + chi_squared_distribution + cpp/numeric/random/chi_squared_distribution/chi_squared_distribution + + (T... args) + + + + std::add_rvalue_reference + cpp/types/add_reference + + + std::basic_istream + cpp/io/basic_istream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::basic_istream::event_callback + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + basic_istream + cpp/io/basic_istream/basic_istream + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + ~basic_istream + cpp/io/basic_istream/~basic_istream + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_istream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + std::basic_istream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_istream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_istream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_istream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::ostream_iterator + cpp/iterator/ostream_iterator + + + std::is_trivially_copy_assignable + cpp/types/is_copy_assignable + + + std::clog + cpp/io/basic_ostream + + + std::is_scalar + cpp/types/is_scalar + + + std::uses_allocator + cpp/memory/uses_allocator + + + std::piecewise_linear_distribution + cpp/numeric/random/piecewise_linear_distribution + + T + piecewise_linear_distribution + cpp/numeric/random/piecewise_linear_distribution/piecewise_linear_distribution + + (T... args) + + + T + densities + cpp/numeric/random/piecewise_linear_distribution/params + + (T... args) + + + T + intervals + cpp/numeric/random/piecewise_linear_distribution/params + + (T... args) + + + T + reset + cpp/numeric/random/piecewise_linear_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/piecewise_linear_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/piecewise_linear_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/piecewise_linear_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/piecewise_linear_distribution/min + + (T... args) + + + + std::hash + cpp/utility/hash + + T + hash + cpp/utility/hash/hash + + (T... args) + + + T + operator() + cpp/utility/hash/operator() + + (T... args) + + + + std::shuffle_order_engine + cpp/numeric/random/shuffle_order_engine + + T + discard + cpp/numeric/random/shuffle_order_engine/discard + + (T... args) + + + T + shuffle_order_engine + cpp/numeric/random/shuffle_order_engine/shuffle_order_engine + + (T... args) + + + T + max + cpp/numeric/random/shuffle_order_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/shuffle_order_engine/operator() + + (T... args) + + + T + base + cpp/numeric/random/shuffle_order_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/shuffle_order_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/shuffle_order_engine/min + + (T... args) + + + + std::chrono + + std::chrono::minutes + + T + time_point_cast + cpp/chrono/time_point/time_point_cast + + (T... args) + + std::chrono::seconds + std::chrono::treat_as_floating_point + std::chrono::duration + std::chrono::milliseconds + std::chrono::steady_clock + std::chrono::system_clock + std::chrono::hours + std::chrono::time_point + std::chrono::high_resolution_clock + std::chrono::duration_values + std::chrono::microseconds + std::chrono::nanoseconds + + T + duration_cast + cpp/chrono/duration/duration_cast + + (T... args) + + + + std::chrono::minutes + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + minutes + cpp/chrono/duration/duration + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::seconds + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + seconds + cpp/chrono/duration/duration + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::treat_as_floating_point + cpp/chrono/treat_as_floating_point + + + std::chrono::duration + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + duration + cpp/chrono/duration/duration + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::milliseconds + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + milliseconds + cpp/chrono/duration/duration + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::steady_clock + cpp/chrono/steady_clock + + T + now + cpp/chrono/steady_clock/now + + (T... args) + + + + std::chrono::system_clock + cpp/chrono/system_clock + + T + now + cpp/chrono/system_clock/now + + (T... args) + + + T + to_time_t + cpp/chrono/system_clock/to_time_t + + (T... args) + + + T + from_time_t + cpp/chrono/system_clock/from_time_t + + (T... args) + + + + std::chrono::hours + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + hours + cpp/chrono/duration/duration + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::time_point + cpp/chrono/time_point + + T + time_since_epoch + cpp/chrono/time_point/time_since_epoch + + (T... args) + + + T + min + cpp/chrono/time_point/min + + (T... args) + + + T + operator- + cpp/chrono/time_point/operator_arith + + (T... args) + + + T + max + cpp/chrono/time_point/max + + (T... args) + + + T + operator+ + cpp/chrono/time_point/operator_arith + + (T... args) + + + T + time_point + cpp/chrono/time_point/time_point + + (T... args) + + + + std::chrono::high_resolution_clock + cpp/chrono/high_resolution_clock + + T + now + cpp/chrono/high_resolution_clock/now + + (T... args) + + + + std::chrono::duration_values + cpp/chrono/duration_values + + T + max + cpp/chrono/duration_values/max + + (T... args) + + + T + zero + cpp/chrono/duration_values/zero + + (T... args) + + + T + min + cpp/chrono/duration_values/min + + (T... args) + + + + std::chrono::microseconds + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + microseconds + cpp/chrono/duration/duration + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::chrono::nanoseconds + cpp/chrono/duration + + T + operator--(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + min + cpp/chrono/duration/min + + (T... args) + + + T + zero + cpp/chrono/duration/zero + + (T... args) + + + T + operator-- + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator+= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator- + cpp/chrono/duration/operator_arith + + (T... args) + + + T + operator/= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator++ + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator++(int) + cpp/chrono/duration/operator_arith2 + + (T... args) + + + T + operator= + cpp/chrono/duration/operator= + + (T... args) + + + T + operator*= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + operator+ + cpp/chrono/duration/operator_arith + + (T... args) + + + T + count + cpp/chrono/duration/count + + (T... args) + + + T + operator%= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + T + max + cpp/chrono/duration/max + + (T... args) + + + T + nanoseconds + cpp/chrono/duration/duration + + (T... args) + + + T + operator-= + cpp/chrono/duration/operator_arith3 + + (T... args) + + + + std::greater + cpp/utility/functional/greater + + T + operator() + cpp/utility/functional/greater + + (T... args) + + + + std::csub_match + cpp/regex/sub_match + + T + csub_match + cpp/regex/sub_match/sub_match + + (T... args) + + + T + operator string_type + cpp/regex/sub_match/str + + (T... args) + + + T + str + cpp/regex/sub_match/str + + (T... args) + + + T + length + cpp/regex/sub_match/length + + (T... args) + + + T + compare + cpp/regex/sub_match/compare + + (T... args) + + + + std::uintmax_t + cpp/types/integer + + + std::remove_pointer + cpp/types/remove_pointer + + + std::numeric_limits + cpp/types/numeric_limits + + T + lowest + cpp/types/numeric_limits/lowest + + (T... args) + + + T + infinity + cpp/types/numeric_limits/infinity + + (T... args) + + + T + signaling_NaN + cpp/types/numeric_limits/signaling_NaN + + (T... args) + + + T + quiet_NaN + cpp/types/numeric_limits/quiet_NaN + + (T... args) + + + T + denorm_min + cpp/types/numeric_limits/denorm_min + + (T... args) + + + T + max + cpp/types/numeric_limits/max + + (T... args) + + + T + round_error + cpp/types/numeric_limits/round_error + + (T... args) + + + T + min + cpp/types/numeric_limits/min + + (T... args) + + + T + epsilon + cpp/types/numeric_limits/epsilon + + (T... args) + + + + std::add_volatile + cpp/types/add_cv + + + std::once_flag + cpp/thread/once_flag + + T + once_flag + cpp/thread/once_flag + + (T... args) + + + + std::is_literal_type + cpp/types/is_literal_type + + + std::money_base + cpp/locale/money_base + std::money_base::pattern + + + std::money_base::pattern + cpp/locale/money_base + + + std::peta + cpp/numeric/ratio/ratio + + + std::is_placeholder + cpp/utility/functional/is_placeholder + + + std::add_const + cpp/types/add_cv + + + std::basic_stringbuf + cpp/io/basic_stringbuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + str + cpp/io/basic_stringbuf/str + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + basic_stringbuf + cpp/io/basic_stringbuf/basic_stringbuf + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + operator= + cpp/io/basic_stringbuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + + std::tm + cpp/chrono/c/tm + + + std::is_abstract + cpp/types/is_abstract + + + std::deque + cpp/container/deque + + T + pop_front + cpp/container/deque/pop_front + + (T... args) + + + T + push_back + cpp/container/deque/push_back + + (T... args) + + + T + shrink_to_fit + cpp/container/deque/shrink_to_fit + + (T... args) + + + T + crbegin + cpp/container/deque/rbegin + + (T... args) + + + T + erase + cpp/container/deque/erase + + (T... args) + + + T + insert + cpp/container/deque/insert + + (T... args) + + + T + ~deque + cpp/container/deque/~deque + + (T... args) + + + T + back + cpp/container/deque/back + + (T... args) + + + T + end + cpp/container/deque/end + + (T... args) + + + T + push_front + cpp/container/deque/push_front + + (T... args) + + + T + emplace_back + cpp/container/deque/emplace_back + + (T... args) + + + T + pop_back + cpp/container/deque/pop_back + + (T... args) + + + T + cbegin + cpp/container/deque/begin + + (T... args) + + + T + front + cpp/container/deque/front + + (T... args) + + + T + deque + cpp/container/deque/deque + + (T... args) + + + T + size + cpp/container/deque/size + + (T... args) + + + T + resize + cpp/container/deque/resize + + (T... args) + + + T + emplace_front + cpp/container/deque/emplace_front + + (T... args) + + + T + rbegin + cpp/container/deque/rbegin + + (T... args) + + + T + crend + cpp/container/deque/rend + + (T... args) + + + T + assign + cpp/container/deque/assign + + (T... args) + + + T + operator= + cpp/container/deque/operator= + + (T... args) + + + T + empty + cpp/container/deque/empty + + (T... args) + + + T + cend + cpp/container/deque/end + + (T... args) + + + T + swap + cpp/container/deque/swap + + (T... args) + + + T + max_size + cpp/container/deque/max_size + + (T... args) + + + T + rend + cpp/container/deque/rend + + (T... args) + + + T + get_allocator + cpp/container/deque/get_allocator + + (T... args) + + + T + clear + cpp/container/deque/clear + + (T... args) + + + T + at + cpp/container/deque/at + + (T... args) + + + T + emplace + cpp/container/deque/emplace + + (T... args) + + + T + operator[] + cpp/container/deque/operator_at + + (T... args) + + + T + begin + cpp/container/deque/begin + + (T... args) + + + + std::allocator + cpp/memory/allocator + + T + allocator + cpp/memory/allocator/allocator + + (T... args) + + + T + allocate + cpp/memory/allocator/allocate + + (T... args) + + + T + destroy + cpp/memory/allocator/destroy + + (T... args) + + + T + ~allocator + cpp/memory/allocator/~allocator + + (T... args) + + + T + max_size + cpp/memory/allocator/max_size + + (T... args) + + + T + address + cpp/memory/allocator/address + + (T... args) + + + T + deallocate + cpp/memory/allocator/deallocate + + (T... args) + + + T + construct + cpp/memory/allocator/construct + + (T... args) + + + + std::scoped_allocator_adaptor + cpp/memory/scoped_allocator_adaptor + + T + deallocate + cpp/memory/scoped_allocator_adaptor/deallocate + + (T... args) + + + T + scoped_allocator_adaptor + cpp/memory/scoped_allocator_adaptor/scoped_allocator_adaptor + + (T... args) + + + T + destroy + cpp/memory/scoped_allocator_adaptor/destroy + + (T... args) + + + T + construct + cpp/memory/scoped_allocator_adaptor/construct + + (T... args) + + + T + max_size + cpp/memory/scoped_allocator_adaptor/max_size + + (T... args) + + + T + inner_allocator + cpp/memory/scoped_allocator_adaptor/inner_allocator + + (T... args) + + + T + select_on_container_copy_construction + cpp/memory/scoped_allocator_adaptor/select_on_container_copy_construction + + (T... args) + + + T + allocate + cpp/memory/scoped_allocator_adaptor/allocate + + (T... args) + + + T + outer_allocator + cpp/memory/scoped_allocator_adaptor/outer_allocator + + (T... args) + + + T + ~scoped_allocator_adaptor + cpp/memory/scoped_allocator_adaptor/~scoped_allocator_adaptor + + (T... args) + + + + std::ssub_match + cpp/regex/sub_match + + T + operator string_type + cpp/regex/sub_match/str + + (T... args) + + + T + ssub_match + cpp/regex/sub_match/sub_match + + (T... args) + + + T + str + cpp/regex/sub_match/str + + (T... args) + + + T + length + cpp/regex/sub_match/length + + (T... args) + + + T + compare + cpp/regex/sub_match/compare + + (T... args) + + + + std::messages_byname + cpp/locale/messages_byname + + T + do_get + cpp/locale/messages/get + + (T... args) + + std::messages_byname::char_type + std::messages_byname::catalog + + T + ~messages_byname + cpp/locale/messages_byname + + (T... args) + + + T + messages_byname + cpp/locale/messages_byname + + (T... args) + + + T + do_open + cpp/locale/messages/open + + (T... args) + + + T + do_close + cpp/locale/messages/close + + (T... args) + + + T + open + cpp/locale/messages/open + + (T... args) + + std::messages_byname::string_type + + T + get + cpp/locale/messages/get + + (T... args) + + + T + close + cpp/locale/messages/close + + (T... args) + + + + std::messages_byname::char_type + cpp/locale/messages + + + std::messages_byname::catalog + cpp/locale/messages_base + + + std::messages_byname::string_type + cpp/locale/messages + + + std::promise + cpp/thread/promise + + T + set_exception + cpp/thread/promise/set_exception + + (T... args) + + + T + operator= + cpp/thread/promise/operator= + + (T... args) + + + T + swap + cpp/thread/promise/swap + + (T... args) + + + T + set_exception_at_thread_exit + cpp/thread/promise/set_exception_at_thread_exit + + (T... args) + + + T + set_value + cpp/thread/promise/set_value + + (T... args) + + + T + get_future + cpp/thread/promise/get_future + + (T... args) + + + T + promise + cpp/thread/promise/promise + + (T... args) + + + T + ~promise + cpp/thread/promise/~promise + + (T... args) + + + T + set_value_at_thread_exit + cpp/thread/promise/set_value_at_thread_exit + + (T... args) + + + + std::add_pointer + cpp/types/add_pointer + + + std::uintptr_t + cpp/types/integer + + + std::bit_and + cpp/utility/functional/bit_and + + T + operator() + cpp/utility/functional/bit_and + + (T... args) + + + + std::uniform_int_distribution + cpp/numeric/random/uniform_int_distribution + + T + min + cpp/numeric/random/uniform_int_distribution/min + + (T... args) + + + T + b + cpp/numeric/random/uniform_int_distribution/params + + (T... args) + + + T + a + cpp/numeric/random/uniform_int_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/uniform_int_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/uniform_int_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/uniform_int_distribution/param + + (T... args) + + + T + reset + cpp/numeric/random/uniform_int_distribution/reset + + (T... args) + + + T + uniform_int_distribution + cpp/numeric/random/uniform_int_distribution/uniform_int_distribution + + (T... args) + + + + std::type_info + cpp/types/type_info + + T + operator!= + cpp/types/type_info/operator_cmp + + (T... args) + + + T + before + cpp/types/type_info/before + + (T... args) + + + T + name + cpp/types/type_info/name + + (T... args) + + + T + operator== + cpp/types/type_info/operator_cmp + + (T... args) + + + T + hash_code + cpp/types/type_info/hash_code + + (T... args) + + + + std::fisher_f_distribution + cpp/numeric/random/fisher_f_distribution + + T + fisher_f_distribution + cpp/numeric/random/fisher_f_distribution/fisher_f_distribution + + (T... args) + + + T + n + cpp/numeric/random/fisher_f_distribution/params + + (T... args) + + + T + reset + cpp/numeric/random/fisher_f_distribution/reset + + (T... args) + + + T + m + cpp/numeric/random/fisher_f_distribution/params + + (T... args) + + + T + operator() + cpp/numeric/random/fisher_f_distribution/operator() + + (T... args) + + + T + max + cpp/numeric/random/fisher_f_distribution/max + + (T... args) + + + T + param + cpp/numeric/random/fisher_f_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/fisher_f_distribution/min + + (T... args) + + + + std::strstream + cpp/io/strstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/strstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + pcount + cpp/io/strstream/pcount + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::strstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::strstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::strstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + strstream + cpp/io/strstream/strstream + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + freeze + cpp/io/strstream/freeze + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + ~strstream + cpp/io/strstream/~strstream + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::strstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::strstream::event_callback + cpp/io/ios_base/event_callback + + + std::strstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::time_get_byname + cpp/locale/time_get_byname + + T + do_get + cpp/locale/time_get/get + + (T... args) + + + T + do_get_monthname + cpp/locale/time_get/get_monthname + + (T... args) + + + T + get_weekday + cpp/locale/time_get/get_weekday + + (T... args) + + + T + do_get_time + cpp/locale/time_get/get_time + + (T... args) + + + T + time_get_byname + cpp/locale/time_get_byname + + (T... args) + + + T + do_get_year + cpp/locale/time_get/get_year + + (T... args) + + std::time_get_byname::iter_type + + T + get_monthname + cpp/locale/time_get/get_monthname + + (T... args) + + + T + ~time_get_byname + cpp/locale/time_get_byname + + (T... args) + + + T + get_time + cpp/locale/time_get/get_time + + (T... args) + + std::time_get_byname::char_type + + T + do_get_date + cpp/locale/time_get/get_date + + (T... args) + + + T + get_date + cpp/locale/time_get/get_date + + (T... args) + + + T + do_date_order + cpp/locale/time_get/date_order + + (T... args) + + + T + get_year + cpp/locale/time_get/get_year + + (T... args) + + + T + date_order + cpp/locale/time_get/date_order + + (T... args) + + + T + get + cpp/locale/time_get/get + + (T... args) + + + T + do_get_weekday + cpp/locale/time_get/get_weekday + + (T... args) + + + + std::time_get_byname::iter_type + cpp/locale/time_get + + + std::time_get_byname::char_type + cpp/locale/time_get + + + std::basic_streambuf + cpp/io/basic_streambuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + basic_streambuf + cpp/io/basic_streambuf/basic_streambuf + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + operator= + cpp/io/basic_streambuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + ~basic_streambuf + cpp/io/basic_streambuf/~basic_streambuf + + (T... args) + + + + std::is_nothrow_constructible + cpp/types/is_constructible + + + std::queue + cpp/container/queue + + T + operator= + cpp/container/queue/operator= + + (T... args) + + + T + swap + cpp/container/queue/swap + + (T... args) + + + T + emplace + cpp/container/queue/emplace + + (T... args) + + + T + empty + cpp/container/queue/empty + + (T... args) + + + T + ~queue + cpp/container/queue/~queue + + (T... args) + + + T + pop + cpp/container/queue/pop + + (T... args) + + + T + front + cpp/container/queue/front + + (T... args) + + + T + push + cpp/container/queue/push + + (T... args) + + + T + queue + cpp/container/queue/queue + + (T... args) + + + T + back + cpp/container/queue/back + + (T... args) + + + T + size + cpp/container/queue/size + + (T... args) + + + + std::is_base_of + cpp/types/is_base_of + + + std::intmax_t + cpp/types/integer + + + std::ranlux24 + cpp/numeric/random/discard_block_engine + + T + discard + cpp/numeric/random/discard_block_engine/discard + + (T... args) + + + T + ranlux24 + cpp/numeric/random/discard_block_engine/discard_block_engine + + (T... args) + + + T + max + cpp/numeric/random/discard_block_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/discard_block_engine/operator() + + (T... args) + + + T + base + cpp/numeric/random/discard_block_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/discard_block_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/discard_block_engine/min + + (T... args) + + + + std::remove_cv + cpp/types/remove_cv + + + std::is_trivially_destructible + cpp/types/is_destructible + + + std::wcin + cpp/io/basic_istream + + + std::atomic + cpp/atomic/atomic + + T + store + cpp/atomic/atomic/store + + (T... args) + + + T + compare_exchange_strong + cpp/atomic/atomic/compare_exchange + + (T... args) + + + T + load + cpp/atomic/atomic/load + + (T... args) + + + T + operator--(int) + cpp/atomic/atomic/operator_arith + + (T... args) + + + T + operator+= + cpp/atomic/atomic/operator_arith2 + + (T... args) + + + T + fetch_or + cpp/atomic/atomic/fetch_or + + (T... args) + + + T + fetch_xor + cpp/atomic/atomic/fetch_xor + + (T... args) + + + T + operator^= + cpp/atomic/atomic/operator_arith2 + + (T... args) + + + T + operator|= + cpp/atomic/atomic/operator_arith2 + + (T... args) + + + T + compare_exchange_weak + cpp/atomic/atomic/compare_exchange + + (T... args) + + + T + operator-= + cpp/atomic/atomic/operator_arith2 + + (T... args) + + + T + fetch_add + cpp/atomic/atomic/fetch_add + + (T... args) + + + T + operator&= + cpp/atomic/atomic/operator_arith2 + + (T... args) + + + T + operator-- + cpp/atomic/atomic/operator_arith + + (T... args) + + + T + atomic + cpp/atomic/atomic/atomic + + (T... args) + + + T + fetch_and + cpp/atomic/atomic/fetch_and + + (T... args) + + + T + exchange + cpp/atomic/atomic/exchange + + (T... args) + + + T + operator T + cpp/atomic/atomic/operator_T + + (T... args) + + + T + operator++(int) + cpp/atomic/atomic/operator_arith + + (T... args) + + + T + operator= + cpp/atomic/atomic/operator= + + (T... args) + + + T + operator++ + cpp/atomic/atomic/operator_arith + + (T... args) + + + T + fetch_sub + cpp/atomic/atomic/fetch_sub + + (T... args) + + + T + is_lock_free + cpp/atomic/atomic/is_lock_free + + (T... args) + + + + std::basic_stringstream + cpp/io/basic_stringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_stringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + basic_stringstream + cpp/io/basic_stringstream/basic_stringstream + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::basic_stringstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::basic_stringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_stringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_stringstream/operator= + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_stringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::basic_stringstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_stringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_void + cpp/types/is_void + + + std::plus + cpp/utility/functional/plus + + T + operator() + cpp/utility/functional/plus + + (T... args) + + + + std::bitset + cpp/utility/bitset + + T + none + cpp/utility/bitset/all_any_none + + (T... args) + + + T + operator<< + cpp/utility/bitset/operator_ltltgtgt + + (T... args) + + + T + operator>> + cpp/utility/bitset/operator_ltltgtgt + + (T... args) + + std::bitset::reference + + T + reset + cpp/utility/bitset/reset + + (T... args) + + + T + count + cpp/utility/bitset/count + + (T... args) + + + T + operator<<= + cpp/utility/bitset/operator_ltltgtgt + + (T... args) + + + T + operator|= + cpp/utility/bitset/operator_logic + + (T... args) + + + T + operator&= + cpp/utility/bitset/operator_logic + + (T... args) + + + T + bitset + cpp/utility/bitset/bitset + + (T... args) + + + T + size + cpp/utility/bitset/size + + (T... args) + + + T + set + cpp/utility/bitset/set + + (T... args) + + + T + all + cpp/utility/bitset/all_any_none + + (T... args) + + + T + to_string + cpp/utility/bitset/to_string + + (T... args) + + + T + operator!= + cpp/utility/bitset/operator_cmp + + (T... args) + + + T + any + cpp/utility/bitset/all_any_none + + (T... args) + + + T + test + cpp/utility/bitset/test + + (T... args) + + + T + operator== + cpp/utility/bitset/operator_cmp + + (T... args) + + + T + operator>>= + cpp/utility/bitset/operator_ltltgtgt + + (T... args) + + + T + to_ulong + cpp/utility/bitset/to_ulong + + (T... args) + + + T + operator^= + cpp/utility/bitset/operator_logic + + (T... args) + + + T + operator~ + cpp/utility/bitset/operator_logic + + (T... args) + + + T + to_ullong + cpp/utility/bitset/to_ullong + + (T... args) + + + T + operator[] + cpp/utility/bitset/operator_at + + (T... args) + + + T + flip + cpp/utility/bitset/flip + + (T... args) + + + + std::bitset::reference + cpp/utility/bitset/reference + + + std::FILE + cpp/io/c + + + std::thread + cpp/thread/thread + + T + joinable + cpp/thread/thread/joinable + + (T... args) + + + T + operator= + cpp/thread/thread/operator= + + (T... args) + + + T + native_handle + cpp/thread/thread/native_handle + + (T... args) + + + T + ~thread + cpp/thread/thread/~thread + + (T... args) + + + T + swap + cpp/thread/thread/swap + + (T... args) + + + T + hardware_concurrency + cpp/thread/thread/hardware_concurrency + + (T... args) + + std::thread::id + + T + thread + cpp/thread/thread/thread + + (T... args) + + + T + join + cpp/thread/thread/join + + (T... args) + + + T + detach + cpp/thread/thread/detach + + (T... args) + + + T + get_id + cpp/thread/thread/get_id + + (T... args) + + + + std::thread::id + cpp/thread/thread/id + + T + operator!= + cpp/thread/thread/id/operator_cmp + + (T... args) + + + T + operator>= + cpp/thread/thread/id/operator_cmp + + (T... args) + + + T + operator<= + cpp/thread/thread/id/operator_cmp + + (T... args) + + + T + operator< + cpp/thread/thread/id/operator_cmp + + (T... args) + + + T + operator== + cpp/thread/thread/id/operator_cmp + + (T... args) + + + T + operator<< + cpp/thread/thread/id/operator_ltlt + + (T... args) + + + T + id + cpp/thread/thread/id/id + + (T... args) + + + T + operator> + cpp/thread/thread/id/operator_cmp + + (T... args) + + + + std::future_error + cpp/thread/future_error + + T + code + cpp/thread/future_error/code + + (T... args) + + + T + future_error + cpp/thread/future_error/future_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::time_base + cpp/locale/time_base + + + std::alignment_of + cpp/types/alignment_of + + + std::time_put + cpp/locale/time_put + std::time_put::char_type + std::time_put::iter_type + + T + do_put + cpp/locale/time_put/put + + (T... args) + + + T + ~time_put + cpp/locale/time_put/~time_put + + (T... args) + + + T + put + cpp/locale/time_put/put + + (T... args) + + + T + time_put + cpp/locale/time_put/time_put + + (T... args) + + + + std::time_put::char_type + cpp/locale/time_put + + + std::time_put::iter_type + cpp/locale/time_put + + + std::bit_or + cpp/utility/functional/bit_or + + T + operator() + cpp/utility/functional/bit_or + + (T... args) + + + + std::pointer_traits + cpp/memory/pointer_traits + + T + pointer_to + cpp/memory/pointer_traits/pointer_to + + (T... args) + + + + std::basic_string + cpp/string/basic_string + + T + push_back + cpp/string/basic_string/push_back + + (T... args) + + + T + shrink_to_fit + cpp/string/basic_string/shrink_to_fit + + (T... args) + + + T + rfind + cpp/string/basic_string/rfind + + (T... args) + + + T + begin + cpp/string/basic_string/begin + + (T... args) + + + T + erase + cpp/string/basic_string/erase + + (T... args) + + + T + append + cpp/string/basic_string/append + + (T... args) + + + T + data + cpp/string/basic_string/data + + (T... args) + + + T + insert + cpp/string/basic_string/insert + + (T... args) + + + T + assign + cpp/string/basic_string/assign + + (T... args) + + + T + find_first_not_of + cpp/string/basic_string/find_first_not_of + + (T... args) + + + T + back + cpp/string/basic_string/back + + (T... args) + + + T + end + cpp/string/basic_string/end + + (T... args) + + + T + resize + cpp/string/basic_string/resize + + (T... args) + + + T + copy + cpp/string/basic_string/copy + + (T... args) + + + T + find_last_of + cpp/string/basic_string/find_last_of + + (T... args) + + + T + pop_back + cpp/string/basic_string/pop_back + + (T... args) + + + T + cbegin + cpp/string/basic_string/begin + + (T... args) + + + T + replace + cpp/string/basic_string/replace + + (T... args) + + + T + front + cpp/string/basic_string/front + + (T... args) + + + T + find + cpp/string/basic_string/find + + (T... args) + + + T + compare + cpp/string/basic_string/compare + + (T... args) + + + T + crbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + at + cpp/string/basic_string/at + + (T... args) + + + T + find_first_of + cpp/string/basic_string/find_first_of + + (T... args) + + + T + rbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + crend + cpp/string/basic_string/rend + + (T... args) + + + T + size + cpp/string/basic_string/size + + (T... args) + + + T + operator= + cpp/string/basic_string/operator= + + (T... args) + + + T + find_last_not_of + cpp/string/basic_string/find_last_not_of + + (T... args) + + + T + reserve + cpp/string/basic_string/reserve + + (T... args) + + + T + capacity + cpp/string/basic_string/capacity + + (T... args) + + + T + c_str + cpp/string/basic_string/c_str + + (T... args) + + + T + empty + cpp/string/basic_string/empty + + (T... args) + + + T + cend + cpp/string/basic_string/end + + (T... args) + + + T + substr + cpp/string/basic_string/substr + + (T... args) + + + T + max_size + cpp/string/basic_string/max_size + + (T... args) + + + T + rend + cpp/string/basic_string/rend + + (T... args) + + + T + get_allocator + cpp/string/basic_string/get_allocator + + (T... args) + + + T + clear + cpp/string/basic_string/clear + + (T... args) + + + T + swap + cpp/string/basic_string/swap + + (T... args) + + + T + operator[] + cpp/string/basic_string/operator_at + + (T... args) + + + T + length + cpp/string/basic_string/size + + (T... args) + + + T + basic_string + cpp/string/basic_string/basic_string + + (T... args) + + + + std::priority_queue + cpp/container/priority_queue + + T + empty + cpp/container/priority_queue/empty + + (T... args) + + + T + swap + cpp/container/priority_queue/swap + + (T... args) + + + T + priority_queue + cpp/container/priority_queue/priority_queue + + (T... args) + + + T + size + cpp/container/priority_queue/size + + (T... args) + + + T + operator= + cpp/container/priority_queue/operator= + + (T... args) + + + T + pop + cpp/container/priority_queue/pop + + (T... args) + + + T + emplace + cpp/container/priority_queue/emplace + + (T... args) + + + T + push + cpp/container/priority_queue/push + + (T... args) + + + T + top + cpp/container/priority_queue/top + + (T... args) + + + T + ~priority_queue + cpp/container/priority_queue/~priority_queue + + (T... args) + + + + std::exa + cpp/numeric/ratio/ratio + + + std::wostringstream + cpp/io/basic_ostringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_ostringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::wostringstream::event_callback + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + wostringstream + cpp/io/basic_ostringstream/basic_ostringstream + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wostringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + operator= + cpp/io/basic_ostringstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::wostringstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wostringstream::event_callback + cpp/io/ios_base/event_callback + + + std::wostringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wostringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::is_default_constructible + cpp/types/is_default_constructible + + + std::cregex_iterator + cpp/regex/regex_iterator + + T + operator!= + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_iterator/operator= + + (T... args) + + + T + cregex_iterator + cpp/regex/regex_iterator/regex_iterator + + (T... args) + + + T + operator-> + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + T + operator== + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator* + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + + std::wstring + cpp/string/basic_string + + T + push_back + cpp/string/basic_string/push_back + + (T... args) + + + T + shrink_to_fit + cpp/string/basic_string/shrink_to_fit + + (T... args) + + + T + rfind + cpp/string/basic_string/rfind + + (T... args) + + + T + begin + cpp/string/basic_string/begin + + (T... args) + + + T + erase + cpp/string/basic_string/erase + + (T... args) + + + T + append + cpp/string/basic_string/append + + (T... args) + + + T + data + cpp/string/basic_string/data + + (T... args) + + + T + insert + cpp/string/basic_string/insert + + (T... args) + + + T + assign + cpp/string/basic_string/assign + + (T... args) + + + T + find_first_not_of + cpp/string/basic_string/find_first_not_of + + (T... args) + + + T + back + cpp/string/basic_string/back + + (T... args) + + + T + end + cpp/string/basic_string/end + + (T... args) + + + T + resize + cpp/string/basic_string/resize + + (T... args) + + + T + copy + cpp/string/basic_string/copy + + (T... args) + + + T + find_last_of + cpp/string/basic_string/find_last_of + + (T... args) + + + T + pop_back + cpp/string/basic_string/pop_back + + (T... args) + + + T + replace + cpp/string/basic_string/replace + + (T... args) + + + T + wstring + cpp/string/basic_string/basic_string + + (T... args) + + + T + front + cpp/string/basic_string/front + + (T... args) + + + T + find + cpp/string/basic_string/find + + (T... args) + + + T + compare + cpp/string/basic_string/compare + + (T... args) + + + T + crbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + cbegin + cpp/string/basic_string/begin + + (T... args) + + + T + find_first_of + cpp/string/basic_string/find_first_of + + (T... args) + + + T + rbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + crend + cpp/string/basic_string/rend + + (T... args) + + + T + size + cpp/string/basic_string/size + + (T... args) + + + T + operator= + cpp/string/basic_string/operator= + + (T... args) + + + T + find_last_not_of + cpp/string/basic_string/find_last_not_of + + (T... args) + + + T + reserve + cpp/string/basic_string/reserve + + (T... args) + + + T + capacity + cpp/string/basic_string/capacity + + (T... args) + + + T + c_str + cpp/string/basic_string/c_str + + (T... args) + + + T + empty + cpp/string/basic_string/empty + + (T... args) + + + T + cend + cpp/string/basic_string/end + + (T... args) + + + T + substr + cpp/string/basic_string/substr + + (T... args) + + + T + max_size + cpp/string/basic_string/max_size + + (T... args) + + + T + rend + cpp/string/basic_string/rend + + (T... args) + + + T + get_allocator + cpp/string/basic_string/get_allocator + + (T... args) + + + T + clear + cpp/string/basic_string/clear + + (T... args) + + + T + at + cpp/string/basic_string/at + + (T... args) + + + T + swap + cpp/string/basic_string/swap + + (T... args) + + + T + operator[] + cpp/string/basic_string/operator_at + + (T... args) + + + T + length + cpp/string/basic_string/size + + (T... args) + + + + std::remove_all_extents + cpp/types/remove_all_extents + + + std::istrstream + cpp/io/istrstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + ~istrstream + cpp/io/istrstream/~istrstream + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/istrstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::istrstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::istrstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + istrstream + cpp/io/istrstream/istrstream + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + std::istrstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::istrstream::event_callback + cpp/io/ios_base/event_callback + + + std::istrstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::istrstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::unary_negate + cpp/utility/functional/unary_negate + + T + operator() + cpp/utility/functional/unary_negate + + (T... args) + + + T + unary_negate + cpp/utility/functional/unary_negate + + (T... args) + + + + std::unordered_multiset + cpp/container/unordered_multiset + + T + max_bucket_count + cpp/container/unordered_multiset/max_bucket_count + + (T... args) + + + T + cbegin + cpp/container/unordered_multiset/begin + + (T... args) + + + T + erase + cpp/container/unordered_multiset/erase + + (T... args) + + + T + insert + cpp/container/unordered_multiset/insert + + (T... args) + + + T + bucket_count + cpp/container/unordered_multiset/bucket_count + + (T... args) + + + T + max_load_factor + cpp/container/unordered_multiset/max_load_factor + + (T... args) + + + T + end + cpp/container/unordered_multiset/end + + (T... args) + + + T + emplace_hint + cpp/container/unordered_multiset/emplace_hint + + (T... args) + + + T + unordered_multiset + cpp/container/unordered_multiset/unordered_multiset + + (T... args) + + + T + end(int) + cpp/container/unordered_multiset/end2 + + (T... args) + + + T + key_eq + cpp/container/unordered_multiset/key_eq + + (T... args) + + + T + hash_function + cpp/container/unordered_multiset/hash_function + + (T... args) + + + T + equal_range + cpp/container/unordered_multiset/equal_range + + (T... args) + + + T + begin + cpp/container/unordered_multiset/begin + + (T... args) + + + T + cbegin(int) + cpp/container/unordered_multiset/begin2 + + (T... args) + + + T + swap + cpp/container/unordered_multiset/swap + + (T... args) + + + T + ~unordered_multiset + cpp/container/unordered_multiset/~unordered_multiset + + (T... args) + + + T + load_factor + cpp/container/unordered_multiset/load_factor + + (T... args) + + + T + size + cpp/container/unordered_multiset/size + + (T... args) + + + T + operator= + cpp/container/unordered_multiset/operator= + + (T... args) + + + T + cend + cpp/container/unordered_multiset/end + + (T... args) + + + T + reserve + cpp/container/unordered_multiset/reserve + + (T... args) + + + T + rehash + cpp/container/unordered_multiset/rehash + + (T... args) + + + T + bucket + cpp/container/unordered_multiset/bucket + + (T... args) + + + T + find + cpp/container/unordered_multiset/find + + (T... args) + + + T + empty + cpp/container/unordered_multiset/empty + + (T... args) + + + T + get_allocator + cpp/container/unordered_multiset/get_allocator + + (T... args) + + + T + max_size + cpp/container/unordered_multiset/max_size + + (T... args) + + + T + cend(int) + cpp/container/unordered_multiset/end2 + + (T... args) + + + T + count + cpp/container/unordered_multiset/count + + (T... args) + + + T + clear + cpp/container/unordered_multiset/clear + + (T... args) + + + T + begin(int) + cpp/container/unordered_multiset/begin2 + + (T... args) + + + T + emplace + cpp/container/unordered_multiset/emplace + + (T... args) + + + T + bucket_size + cpp/container/unordered_multiset/bucket_size + + (T... args) + + + + std::basic_ostream + cpp/io/basic_ostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::basic_ostream::event_callback + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_ostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + basic_ostream + cpp/io/basic_ostream/basic_ostream + + (T... args) + + + T + ~basic_ostream + cpp/io/basic_ostream/~basic_ostream + + (T... args) + + std::basic_ostream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_ostream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_ostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_ostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::wsregex_iterator + cpp/regex/regex_iterator + + T + wsregex_iterator + cpp/regex/regex_iterator/regex_iterator + + (T... args) + + + T + operator= + cpp/regex/regex_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_iterator/operator* + + (T... args) + + + T + operator!= + cpp/regex/regex_iterator/operator_cmp + + (T... args) + + + T + operator++(int) + cpp/regex/regex_iterator/operator_arith + + (T... args) + + + + std::uint_fast16_t + cpp/types/integer + + + std::is_nothrow_assignable + cpp/types/is_assignable + + + std::moneypunct + cpp/locale/moneypunct + + T + do_curr_symbol + cpp/locale/moneypunct/curr_symbol + + (T... args) + + + T + do_decimal_point + cpp/locale/moneypunct/decimal_point + + (T... args) + + + T + thousands_sep + cpp/locale/moneypunct/thousands_sep + + (T... args) + + + T + do_pos_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + curr_symbol + cpp/locale/moneypunct/curr_symbol + + (T... args) + + + T + positive_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + frac_digits + cpp/locale/moneypunct/frac_digits + + (T... args) + + + T + do_negative_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + ~moneypunct + cpp/locale/moneypunct/~moneypunct + + (T... args) + + + T + pos_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + do_thousands_sep + cpp/locale/moneypunct/thousands_sep + + (T... args) + + + T + neg_format + cpp/locale/moneypunct/pos_format + + (T... args) + + + T + negative_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + + T + grouping + cpp/locale/moneypunct/grouping + + (T... args) + + + T + do_frac_digits + cpp/locale/moneypunct/frac_digits + + (T... args) + + + T + decimal_point + cpp/locale/moneypunct/decimal_point + + (T... args) + + + T + do_neg_format + cpp/locale/moneypunct/pos_format + + (T... args) + + std::moneypunct::string_type + std::moneypunct::pattern + + T + do_positive_sign + cpp/locale/moneypunct/positive_sign + + (T... args) + + std::moneypunct::char_type + + T + moneypunct + cpp/locale/moneypunct/moneypunct + + (T... args) + + + T + do_grouping + cpp/locale/moneypunct/grouping + + (T... args) + + + + std::moneypunct::string_type + cpp/locale/moneypunct + + + std::moneypunct::pattern + cpp/locale/money_base + + + std::moneypunct::char_type + cpp/locale/moneypunct + + + std::type_index + cpp/types/type_index + + T + operator!= + cpp/types/type_index/operator_cmp + + (T... args) + + + T + hash_code + cpp/types/type_index/hash_code + + (T... args) + + + T + operator<= + cpp/types/type_index/operator_cmp + + (T... args) + + + T + operator< + cpp/types/type_index/operator_cmp + + (T... args) + + + T + operator== + cpp/types/type_index/operator_cmp + + (T... args) + + + T + operator>= + cpp/types/type_index/operator_cmp + + (T... args) + + + T + type_index + cpp/types/type_index/type_index + + (T... args) + + + T + name + cpp/types/type_index/name + + (T... args) + + + T + operator> + cpp/types/type_index/operator_cmp + + (T... args) + + + + std::is_standard_layout + cpp/types/is_standard_layout + + + std::timed_mutex + cpp/thread/timed_mutex + + T + unlock + cpp/thread/timed_mutex/unlock + + (T... args) + + + T + native_handle + cpp/thread/timed_mutex/native_handle + + (T... args) + + + T + try_lock_until + cpp/thread/timed_mutex/try_lock_until + + (T... args) + + + T + try_lock_for + cpp/thread/timed_mutex/try_lock_for + + (T... args) + + + T + lock + cpp/thread/timed_mutex/lock + + (T... args) + + + T + try_lock + cpp/thread/timed_mutex/try_lock + + (T... args) + + + T + timed_mutex + cpp/thread/timed_mutex/timed_mutex + + (T... args) + + + + std::bad_exception + cpp/error/bad_exception + + + std::int_fast64_t + cpp/types/integer + + + std::function + cpp/utility/functional/function + + T + operator= + cpp/utility/functional/function/operator= + + (T... args) + + + T + swap + cpp/utility/functional/function/swap + + (T... args) + + + T + assign + cpp/utility/functional/function/assign + + (T... args) + + + T + target + cpp/utility/functional/function/target + + (T... args) + + + T + operator() + cpp/utility/functional/function/operator() + + (T... args) + + + T + target_type + cpp/utility/functional/function/target_type + + (T... args) + + + T + function + cpp/utility/functional/function/function + + (T... args) + + + T + operator bool + cpp/utility/functional/function/operator_bool + + (T... args) + + + T + ~function + cpp/utility/functional/function/~function + + (T... args) + + + + std::bad_cast + cpp/types/bad_cast + + T + bad_cast + cpp/types/bad_cast/bad_cast + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::error_condition + cpp/error/error_condition + + T + error_condition + cpp/error/error_condition/error_condition + + (T... args) + + + T + operator= + cpp/error/error_condition/operator= + + (T... args) + + + T + operator bool + cpp/error/error_condition/operator_bool + + (T... args) + + + T + assign + cpp/error/error_condition/assign + + (T... args) + + + T + value + cpp/error/error_condition/value + + (T... args) + + + T + clear + cpp/error/error_condition/clear + + (T... args) + + + T + message + cpp/error/error_condition/message + + (T... args) + + + T + category + cpp/error/error_condition/category + + (T... args) + + + + std::filebuf + cpp/io/basic_filebuf + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + is_open + cpp/io/basic_filebuf/is_open + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + filebuf + cpp/io/basic_filebuf/basic_filebuf + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + close + cpp/io/basic_filebuf/close + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + open + cpp/io/basic_filebuf/open + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + ~filebuf + cpp/io/basic_filebuf/~basic_filebuf + + (T... args) + + + T + operator= + cpp/io/basic_filebuf/operator= + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + + std::int_least16_t + cpp/types/integer + + + std::istreambuf_iterator + cpp/iterator/istreambuf_iterator + + + std::u16string + cpp/string/basic_string + + T + push_back + cpp/string/basic_string/push_back + + (T... args) + + + T + shrink_to_fit + cpp/string/basic_string/shrink_to_fit + + (T... args) + + + T + rfind + cpp/string/basic_string/rfind + + (T... args) + + + T + begin + cpp/string/basic_string/begin + + (T... args) + + + T + erase + cpp/string/basic_string/erase + + (T... args) + + + T + append + cpp/string/basic_string/append + + (T... args) + + + T + data + cpp/string/basic_string/data + + (T... args) + + + T + insert + cpp/string/basic_string/insert + + (T... args) + + + T + assign + cpp/string/basic_string/assign + + (T... args) + + + T + find_first_not_of + cpp/string/basic_string/find_first_not_of + + (T... args) + + + T + back + cpp/string/basic_string/back + + (T... args) + + + T + end + cpp/string/basic_string/end + + (T... args) + + + T + resize + cpp/string/basic_string/resize + + (T... args) + + + T + copy + cpp/string/basic_string/copy + + (T... args) + + + T + find_last_of + cpp/string/basic_string/find_last_of + + (T... args) + + + T + pop_back + cpp/string/basic_string/pop_back + + (T... args) + + + T + replace + cpp/string/basic_string/replace + + (T... args) + + + T + front + cpp/string/basic_string/front + + (T... args) + + + T + substr + cpp/string/basic_string/substr + + (T... args) + + + T + find + cpp/string/basic_string/find + + (T... args) + + + T + compare + cpp/string/basic_string/compare + + (T... args) + + + T + crbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + cbegin + cpp/string/basic_string/begin + + (T... args) + + + T + find_first_of + cpp/string/basic_string/find_first_of + + (T... args) + + + T + rbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + crend + cpp/string/basic_string/rend + + (T... args) + + + T + size + cpp/string/basic_string/size + + (T... args) + + + T + operator= + cpp/string/basic_string/operator= + + (T... args) + + + T + find_last_not_of + cpp/string/basic_string/find_last_not_of + + (T... args) + + + T + reserve + cpp/string/basic_string/reserve + + (T... args) + + + T + capacity + cpp/string/basic_string/capacity + + (T... args) + + + T + c_str + cpp/string/basic_string/c_str + + (T... args) + + + T + empty + cpp/string/basic_string/empty + + (T... args) + + + T + cend + cpp/string/basic_string/end + + (T... args) + + + T + u16string + cpp/string/basic_string/basic_string + + (T... args) + + + T + max_size + cpp/string/basic_string/max_size + + (T... args) + + + T + rend + cpp/string/basic_string/rend + + (T... args) + + + T + get_allocator + cpp/string/basic_string/get_allocator + + (T... args) + + + T + clear + cpp/string/basic_string/clear + + (T... args) + + + T + at + cpp/string/basic_string/at + + (T... args) + + + T + swap + cpp/string/basic_string/swap + + (T... args) + + + T + operator[] + cpp/string/basic_string/operator_at + + (T... args) + + + T + length + cpp/string/basic_string/size + + (T... args) + + + + std::is_error_condition_enum + cpp/error/error_condition/is_error_condition_enum + + + std::is_nothrow_destructible + cpp/types/is_destructible + + + std::wiostream + cpp/io/basic_iostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::wiostream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::wiostream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + wiostream + cpp/io/basic_iostream/basic_iostream + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wiostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + ~wiostream + cpp/io/basic_iostream/~basic_iostream + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wiostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::wiostream::event_callback + cpp/io/ios_base/event_callback + + + std::wiostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::allocator_arg_t + cpp/memory/allocator_arg_t + + + std::rel_ops + + + T + operator!= + cpp/utility/rel_ops/operator_cmp + + (T... args) + + + T + operator>= + cpp/utility/rel_ops/operator_cmp + + (T... args) + + + T + operator<= + cpp/utility/rel_ops/operator_cmp + + (T... args) + + + T + operator> + cpp/utility/rel_ops/operator_cmp + + (T... args) + + + + std::uint_least32_t + cpp/types/integer + + + std::collate + cpp/locale/collate + + T + hash + cpp/locale/collate/hash + + (T... args) + + + T + do_hash + cpp/locale/collate/hash + + (T... args) + + + T + collate + cpp/locale/collate/collate + + (T... args) + + std::collate::char_type + + T + ~collate + cpp/locale/collate/~collate + + (T... args) + + + T + do_transform + cpp/locale/collate/transform + + (T... args) + + + T + transform + cpp/locale/collate/transform + + (T... args) + + + T + do_compare + cpp/locale/collate/compare + + (T... args) + + std::collate::string_type + + T + compare + cpp/locale/collate/compare + + (T... args) + + + + std::collate::char_type + cpp/locale/collate + + + std::collate::string_type + cpp/locale/collate + + + std::remove_const + cpp/types/remove_cv + + + std::u32string + cpp/string/basic_string + + T + push_back + cpp/string/basic_string/push_back + + (T... args) + + + T + shrink_to_fit + cpp/string/basic_string/shrink_to_fit + + (T... args) + + + T + rfind + cpp/string/basic_string/rfind + + (T... args) + + + T + begin + cpp/string/basic_string/begin + + (T... args) + + + T + erase + cpp/string/basic_string/erase + + (T... args) + + + T + append + cpp/string/basic_string/append + + (T... args) + + + T + data + cpp/string/basic_string/data + + (T... args) + + + T + insert + cpp/string/basic_string/insert + + (T... args) + + + T + u32string + cpp/string/basic_string/basic_string + + (T... args) + + + T + find_first_not_of + cpp/string/basic_string/find_first_not_of + + (T... args) + + + T + back + cpp/string/basic_string/back + + (T... args) + + + T + end + cpp/string/basic_string/end + + (T... args) + + + T + resize + cpp/string/basic_string/resize + + (T... args) + + + T + copy + cpp/string/basic_string/copy + + (T... args) + + + T + find_last_of + cpp/string/basic_string/find_last_of + + (T... args) + + + T + pop_back + cpp/string/basic_string/pop_back + + (T... args) + + + T + cbegin + cpp/string/basic_string/begin + + (T... args) + + + T + replace + cpp/string/basic_string/replace + + (T... args) + + + T + front + cpp/string/basic_string/front + + (T... args) + + + T + find + cpp/string/basic_string/find + + (T... args) + + + T + compare + cpp/string/basic_string/compare + + (T... args) + + + T + crbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + size + cpp/string/basic_string/size + + (T... args) + + + T + find_first_of + cpp/string/basic_string/find_first_of + + (T... args) + + + T + rbegin + cpp/string/basic_string/rbegin + + (T... args) + + + T + crend + cpp/string/basic_string/rend + + (T... args) + + + T + assign + cpp/string/basic_string/assign + + (T... args) + + + T + operator= + cpp/string/basic_string/operator= + + (T... args) + + + T + find_last_not_of + cpp/string/basic_string/find_last_not_of + + (T... args) + + + T + reserve + cpp/string/basic_string/reserve + + (T... args) + + + T + capacity + cpp/string/basic_string/capacity + + (T... args) + + + T + c_str + cpp/string/basic_string/c_str + + (T... args) + + + T + empty + cpp/string/basic_string/empty + + (T... args) + + + T + cend + cpp/string/basic_string/end + + (T... args) + + + T + substr + cpp/string/basic_string/substr + + (T... args) + + + T + max_size + cpp/string/basic_string/max_size + + (T... args) + + + T + rend + cpp/string/basic_string/rend + + (T... args) + + + T + get_allocator + cpp/string/basic_string/get_allocator + + (T... args) + + + T + clear + cpp/string/basic_string/clear + + (T... args) + + + T + at + cpp/string/basic_string/at + + (T... args) + + + T + swap + cpp/string/basic_string/swap + + (T... args) + + + T + operator[] + cpp/string/basic_string/operator_at + + (T... args) + + + T + length + cpp/string/basic_string/size + + (T... args) + + + + std::uint_fast32_t + cpp/types/integer + + + std::is_lvalue_reference + cpp/types/is_lvalue_reference + + + std::complex + cpp/numeric/complex + + T + operator= + cpp/numeric/complex/operator= + + (T... args) + + + T + complex + cpp/numeric/complex/complex + + (T... args) + + + T + operator-= + cpp/numeric/complex/operator_arith + + (T... args) + + + T + imag + cpp/numeric/complex/imag + + (T... args) + + + T + operator+= + cpp/numeric/complex/operator_arith + + (T... args) + + + T + operator/= + cpp/numeric/complex/operator_arith + + (T... args) + + + T + operator*= + cpp/numeric/complex/operator_arith + + (T... args) + + + T + real + cpp/numeric/complex/real + + (T... args) + + + + std::ofstream + cpp/io/basic_ofstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::ofstream::event_callback + + T + open + cpp/io/basic_ofstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ofstream/close + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::ofstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ofstream/is_open + + (T... args) + + + T + operator= + cpp/io/basic_ofstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::ofstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + ofstream + cpp/io/basic_ofstream/basic_ofstream + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::ofstream::event_callback + cpp/io/ios_base/event_callback + + + std::ofstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ofstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::insert_iterator + cpp/iterator/insert_iterator + + + std::bad_array_length + cpp/memory/new/bad_array_length + + T + bad_array_length + cpp/memory/new/bad_array_length + + (T... args) + + + T + what + cpp/memory/new/bad_alloc + + (T... args) + + + + std::this_thread + + + T + yield + cpp/thread/yield + + (T... args) + + + T + sleep_for + cpp/thread/sleep_for + + (T... args) + + + T + sleep_until + cpp/thread/sleep_until + + (T... args) + + + T + get_id + cpp/thread/get_id + + (T... args) + + + + std::is_trivially_copyable + cpp/types/is_trivially_copyable + + + std::basic_istringstream + cpp/io/basic_istringstream + + T + basic_istringstream + cpp/io/basic_istringstream/basic_istringstream + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_istringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::basic_istringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::basic_istringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_istringstream/operator= + + (T... args) + + std::basic_istringstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_istringstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_istringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_istringstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::basic_ifstream + cpp/io/basic_ifstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + basic_ifstream + cpp/io/basic_ifstream/basic_ifstream + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + open + cpp/io/basic_ifstream/open + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::basic_ifstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ifstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::basic_ifstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ifstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_ifstream/operator= + + (T... args) + + std::basic_ifstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_ifstream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_ifstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::basic_ifstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::list + cpp/container/list + + T + pop_front + cpp/container/list/pop_front + + (T... args) + + + T + push_back + cpp/container/list/push_back + + (T... args) + + + T + splice + cpp/container/list/splice + + (T... args) + + + T + crbegin + cpp/container/list/rbegin + + (T... args) + + + T + erase + cpp/container/list/erase + + (T... args) + + + T + emplace_front + cpp/container/list/emplace_front + + (T... args) + + + T + insert + cpp/container/list/insert + + (T... args) + + + T + reverse + cpp/container/list/reverse + + (T... args) + + + T + back + cpp/container/list/back + + (T... args) + + + T + end + cpp/container/list/end + + (T... args) + + + T + remove + cpp/container/list/remove + + (T... args) + + + T + list + cpp/container/list/list + + (T... args) + + + T + emplace_back + cpp/container/list/emplace_back + + (T... args) + + + T + pop_back + cpp/container/list/pop_back + + (T... args) + + + T + cbegin + cpp/container/list/begin + + (T... args) + + + T + front + cpp/container/list/front + + (T... args) + + + T + unique + cpp/container/list/unique + + (T... args) + + + T + size + cpp/container/list/size + + (T... args) + + + T + resize + cpp/container/list/resize + + (T... args) + + + T + push_front + cpp/container/list/push_front + + (T... args) + + + T + rbegin + cpp/container/list/rbegin + + (T... args) + + + T + crend + cpp/container/list/rend + + (T... args) + + + T + assign + cpp/container/list/assign + + (T... args) + + + T + operator= + cpp/container/list/operator= + + (T... args) + + + T + sort + cpp/container/list/sort + + (T... args) + + + T + ~list + cpp/container/list/~list + + (T... args) + + + T + merge + cpp/container/list/merge + + (T... args) + + + T + empty + cpp/container/list/empty + + (T... args) + + + T + remove_if + cpp/container/list/remove + + (T... args) + + + T + cend + cpp/container/list/end + + (T... args) + + + T + swap + cpp/container/list/swap + + (T... args) + + + T + max_size + cpp/container/list/max_size + + (T... args) + + + T + rend + cpp/container/list/rend + + (T... args) + + + T + get_allocator + cpp/container/list/get_allocator + + (T... args) + + + T + clear + cpp/container/list/clear + + (T... args) + + + T + emplace + cpp/container/list/emplace + + (T... args) + + + T + begin + cpp/container/list/begin + + (T... args) + + + + std::minus + cpp/utility/functional/minus + + T + operator() + cpp/utility/functional/minus + + (T... args) + + + + std::map + cpp/container/map + + T + begin + cpp/container/map/begin + + (T... args) + + + T + erase + cpp/container/map/erase + + (T... args) + + + T + insert + cpp/container/map/insert + + (T... args) + + + T + swap + cpp/container/map/swap + + (T... args) + + + T + end + cpp/container/map/end + + (T... args) + + + T + emplace_hint + cpp/container/map/emplace_hint + + (T... args) + + + T + key_comp + cpp/container/map/key_comp + + (T... args) + + std::map::value_compare + + T + cbegin + cpp/container/map/begin + + (T... args) + + + T + count + cpp/container/map/count + + (T... args) + + + T + find + cpp/container/map/find + + (T... args) + + + T + map + cpp/container/map/map + + (T... args) + + + T + crbegin + cpp/container/map/rbegin + + (T... args) + + + T + at + cpp/container/map/at + + (T... args) + + + T + upper_bound + cpp/container/map/upper_bound + + (T... args) + + + T + rbegin + cpp/container/map/rbegin + + (T... args) + + + T + crend + cpp/container/map/rend + + (T... args) + + + T + size + cpp/container/map/size + + (T... args) + + + T + operator= + cpp/container/map/operator= + + (T... args) + + + T + ~map + cpp/container/map/~map + + (T... args) + + + T + value_comp + cpp/container/map/value_comp + + (T... args) + + + T + empty + cpp/container/map/empty + + (T... args) + + + T + lower_bound + cpp/container/map/lower_bound + + (T... args) + + + T + cend + cpp/container/map/end + + (T... args) + + + T + max_size + cpp/container/map/max_size + + (T... args) + + + T + rend + cpp/container/map/rend + + (T... args) + + + T + get_allocator + cpp/container/map/get_allocator + + (T... args) + + + T + clear + cpp/container/map/clear + + (T... args) + + + T + equal_range + cpp/container/map/equal_range + + (T... args) + + + T + emplace + cpp/container/map/emplace + + (T... args) + + + T + operator[] + cpp/container/map/operator_at + + (T... args) + + + + std::map::value_compare + cpp/container/map/value_compare + + + std::linear_congruential_engine + cpp/numeric/random/linear_congruential_engine + + T + discard + cpp/numeric/random/linear_congruential_engine/discard + + (T... args) + + + T + linear_congruential_engine + cpp/numeric/random/linear_congruential_engine/linear_congruential_engine + + (T... args) + + + T + max + cpp/numeric/random/linear_congruential_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/linear_congruential_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/linear_congruential_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/linear_congruential_engine/min + + (T... args) + + + + std::codecvt_utf16 + cpp/locale/codecvt_utf16 + std::codecvt_utf16::extern_type + + T + out + cpp/locale/codecvt/out + + (T... args) + + + T + do_length + cpp/locale/codecvt/length + + (T... args) + + + T + do_unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + do_encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + do_in + cpp/locale/codecvt/in + + (T... args) + + + T + unshift + cpp/locale/codecvt/unshift + + (T... args) + + + T + max_length + cpp/locale/codecvt/max_length + + (T... args) + + std::codecvt_utf16::state_type + + T + encoding + cpp/locale/codecvt/encoding + + (T... args) + + + T + always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + do_out + cpp/locale/codecvt/out + + (T... args) + + + T + do_max_length + cpp/locale/codecvt/max_length + + (T... args) + + + T + do_always_noconv + cpp/locale/codecvt/always_noconv + + (T... args) + + + T + in + cpp/locale/codecvt/in + + (T... args) + + std::codecvt_utf16::intern_type + + T + length + cpp/locale/codecvt/length + + (T... args) + + + + std::codecvt_utf16::extern_type + cpp/locale/codecvt + + + std::codecvt_utf16::state_type + cpp/locale/codecvt + + + std::codecvt_utf16::intern_type + cpp/locale/codecvt + + + std::cmatch + cpp/regex/match_results + + T + cbegin + cpp/regex/match_results/begin + + (T... args) + + + T + format + cpp/regex/match_results/format + + (T... args) + + + T + size + cpp/regex/match_results/size + + (T... args) + + + T + swap + cpp/regex/match_results/swap + + (T... args) + + + T + position + cpp/regex/match_results/position + + (T... args) + + + T + ~cmatch + cpp/regex/match_results/~match_results + + (T... args) + + + T + prefix + cpp/regex/match_results/prefix + + (T... args) + + + T + str + cpp/regex/match_results/str + + (T... args) + + + T + empty + cpp/regex/match_results/empty + + (T... args) + + + T + suffix + cpp/regex/match_results/suffix + + (T... args) + + + T + get_allocator + cpp/regex/match_results/get_allocator + + (T... args) + + + T + end + cpp/regex/match_results/end + + (T... args) + + + T + max_size + cpp/regex/match_results/max_size + + (T... args) + + + T + cmatch + cpp/regex/match_results/match_results + + (T... args) + + + T + ready + cpp/regex/match_results/ready + + (T... args) + + + T + cend + cpp/regex/match_results/end + + (T... args) + + + T + operator[] + cpp/regex/match_results/operator_at + + (T... args) + + + T + length + cpp/regex/match_results/length + + (T... args) + + + T + begin + cpp/regex/match_results/begin + + (T... args) + + + + std::defer_lock_t + cpp/thread/lock_tag_t + + + std::exception + cpp/error/exception + + T + what + cpp/error/exception/what + + (T... args) + + + T + ~exception + cpp/error/exception/~exception + + (T... args) + + + T + operator= + cpp/error/exception/operator= + + (T... args) + + + T + exception + cpp/error/exception/exception + + (T... args) + + + + std::front_insert_iterator + cpp/iterator/front_insert_iterator + + + std::zetta + cpp/numeric/ratio/ratio + + + std::streambuf + cpp/io/basic_streambuf + + T + pptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + epptr + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + eback + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + setp + cpp/io/basic_streambuf/setp + + (T... args) + + + T + sputbackc + cpp/io/basic_streambuf/sputbackc + + (T... args) + + + T + getloc + cpp/io/basic_streambuf/getloc + + (T... args) + + + T + seekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + imbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + sungetc + cpp/io/basic_streambuf/sungetc + + (T... args) + + + T + sync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + xsputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + pbase + cpp/io/basic_streambuf/pptr + + (T... args) + + + T + sgetc + cpp/io/basic_streambuf/sgetc + + (T... args) + + + T + pubimbue + cpp/io/basic_streambuf/pubimbue + + (T... args) + + + T + showmanyc + cpp/io/basic_streambuf/showmanyc + + (T... args) + + + T + snextc + cpp/io/basic_streambuf/snextc + + (T... args) + + + T + egptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + seekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + T + underflow + cpp/io/basic_streambuf/underflow + + (T... args) + + + T + setbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + gbump + cpp/io/basic_streambuf/gbump + + (T... args) + + + T + in_avail + cpp/io/basic_streambuf/in_avail + + (T... args) + + + T + swap + cpp/io/basic_streambuf/swap + + (T... args) + + + T + pbackfail + cpp/io/basic_streambuf/pbackfail + + (T... args) + + + T + sputc + cpp/io/basic_streambuf/sputc + + (T... args) + + + T + xsgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + uflow + cpp/io/basic_streambuf/uflow + + (T... args) + + + T + overflow + cpp/io/basic_streambuf/overflow + + (T... args) + + + T + sputn + cpp/io/basic_streambuf/sputn + + (T... args) + + + T + sgetn + cpp/io/basic_streambuf/sgetn + + (T... args) + + + T + sbumpc + cpp/io/basic_streambuf/sbumpc + + (T... args) + + + T + ~streambuf + cpp/io/basic_streambuf/~basic_streambuf + + (T... args) + + + T + operator= + cpp/io/basic_streambuf/operator= + + (T... args) + + + T + pbump + cpp/io/basic_streambuf/pbump + + (T... args) + + + T + pubsetbuf + cpp/io/basic_streambuf/pubsetbuf + + (T... args) + + + T + pubsync + cpp/io/basic_streambuf/pubsync + + (T... args) + + + T + pubseekoff + cpp/io/basic_streambuf/pubseekoff + + (T... args) + + + T + setg + cpp/io/basic_streambuf/setg + + (T... args) + + + T + streambuf + cpp/io/basic_streambuf/basic_streambuf + + (T... args) + + + T + gptr + cpp/io/basic_streambuf/gptr + + (T... args) + + + T + pubseekpos + cpp/io/basic_streambuf/pubseekpos + + (T... args) + + + + std::experimental + + + T + make_optional + cpp/experimental/optional/make_optional + + (T... args) + + std::experimental::optional + + + std::experimental::optional + cpp/experimental/optional + + T + operator= + cpp/experimental/optional/operator= + + (T... args) + + + T + operator bool + cpp/experimental/optional/operator_bool + + (T... args) + + + T + optional + cpp/experimental/optional/optional + + (T... args) + + + T + ~optional + cpp/experimental/optional/~optional + + (T... args) + + + T + operator-> + cpp/experimental/optional/operator* + + (T... args) + + + T + value + cpp/experimental/optional/value + + (T... args) + + + T + value_or + cpp/experimental/optional/value_or + + (T... args) + + + T + operator* + cpp/experimental/optional/operator* + + (T... args) + + + T + emplace + cpp/experimental/optional/emplace + + (T... args) + + + T + swap + cpp/experimental/optional/swap + + (T... args) + + + + std::num_put + cpp/locale/num_put + + T + num_put + cpp/locale/num_put/num_put + + (T... args) + + std::num_put::char_type + + T + ~num_put + cpp/locale/num_put/~num_put + + (T... args) + + + T + do_put + cpp/locale/num_put/put + + (T... args) + + + T + put + cpp/locale/num_put/put + + (T... args) + + std::num_put::iter_type + + + std::num_put::char_type + cpp/locale/num_put + + + std::num_put::iter_type + cpp/locale/num_put + + + std::owner_less + cpp/memory/owner_less + + T + operator() + cpp/memory/owner_less + + (T... args) + + + + std::extent + cpp/types/extent + + + std::bad_optional_access + cpp/utility/bad_optional_access + + T + bad_optional_access + cpp/utility/bad_optional_access + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::yotta + cpp/numeric/ratio/ratio + + + std::wcregex_token_iterator + cpp/regex/regex_token_iterator + + T + operator!= + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_token_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + wcregex_token_iterator + cpp/regex/regex_token_iterator/regex_token_iterator + + (T... args) + + + + std::uint64_t + cpp/types/integer + + + std::messages + cpp/locale/messages + + T + do_get + cpp/locale/messages/get + + (T... args) + + + T + do_close + cpp/locale/messages/close + + (T... args) + + std::messages::char_type + + T + get + cpp/locale/messages/get + + (T... args) + + + T + ~messages + cpp/locale/messages/~messages + + (T... args) + + + T + do_open + cpp/locale/messages/open + + (T... args) + + + T + messages + cpp/locale/messages/messages + + (T... args) + + + T + open + cpp/locale/messages/open + + (T... args) + + std::messages::string_type + std::messages::catalog + + T + close + cpp/locale/messages/close + + (T... args) + + + + std::messages::char_type + cpp/locale/messages + + + std::messages::string_type + cpp/locale/messages + + + std::messages::catalog + cpp/locale/messages_base + + + std::regex_token_iterator + cpp/regex/regex_token_iterator + + T + regex_token_iterator + cpp/regex/regex_token_iterator/regex_token_iterator + + (T... args) + + + T + operator= + cpp/regex/regex_token_iterator/operator= + + (T... args) + + + T + operator== + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator!= + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator++(int) + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + + std::move_iterator + cpp/iterator/move_iterator + + + std::messages_base + cpp/locale/messages_base + std::messages_base::catalog + + + std::messages_base::catalog + cpp/locale/messages_base + + + std::istringstream + cpp/io/basic_istringstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_istringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + istringstream + cpp/io/basic_istringstream/basic_istringstream + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::istringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::istringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_istringstream/operator= + + (T... args) + + std::istringstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::istringstream::event_callback + cpp/io/ios_base/event_callback + + + std::istringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::istringstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::giga + cpp/numeric/ratio/ratio + + + std::integer_sequence + cpp/utility/integer_sequence + + + std::has_virtual_destructor + cpp/types/has_virtual_destructor + + + std::max_align_t + cpp/types/max_align_t + + + std::remove_volatile + cpp/types/remove_cv + + + std::underlying_type + cpp/types/underlying_type + + + std::hecto + cpp/numeric/ratio/ratio + + + std::is_member_object_pointer + cpp/types/is_member_object_pointer + + + std::exception_ptr + cpp/error/exception_ptr + + + std::nested_exception + cpp/error/nested_exception + + T + operator= + cpp/error/nested_exception/operator= + + (T... args) + + + T + ~nested_exception + cpp/error/nested_exception/~nested_exception + + (T... args) + + + T + rethrow_nested + cpp/error/nested_exception/rethrow_nested + + (T... args) + + + T + nested_exception + cpp/error/nested_exception/nested_exception + + (T... args) + + + T + nested_ptr + cpp/error/nested_exception/nested_ptr + + (T... args) + + + + std::random_access_iterator_tag + cpp/iterator/iterator_tags + + + std::ctype + cpp/locale/ctype + + T + do_toupper + cpp/locale/ctype/toupper + + (T... args) + + + T + toupper + cpp/locale/ctype/toupper + + (T... args) + + + T + scan_is + cpp/locale/ctype/scan_is + + (T... args) + + + T + narrow + cpp/locale/ctype/narrow + + (T... args) + + + T + ~ctype + cpp/locale/ctype/~ctype + + (T... args) + + + T + do_narrow + cpp/locale/ctype/narrow + + (T... args) + + + T + widen + cpp/locale/ctype/widen + + (T... args) + + + T + is + cpp/locale/ctype/is + + (T... args) + + + T + do_scan_is + cpp/locale/ctype/scan_is + + (T... args) + + + T + tolower + cpp/locale/ctype/tolower + + (T... args) + + + T + do_is + cpp/locale/ctype/is + + (T... args) + + + T + do_tolower + cpp/locale/ctype/tolower + + (T... args) + + std::ctype::mask + + T + do_widen + cpp/locale/ctype/widen + + (T... args) + + + T + ctype + cpp/locale/ctype/ctype + + (T... args) + + + + std::ctype::mask + cpp/locale/ctype_base + + + std::time_t + cpp/chrono/c/time_t + + + std::knuth_b + cpp/numeric/random/shuffle_order_engine + + T + discard + cpp/numeric/random/shuffle_order_engine/discard + + (T... args) + + + T + max + cpp/numeric/random/shuffle_order_engine/max + + (T... args) + + + T + knuth_b + cpp/numeric/random/shuffle_order_engine/shuffle_order_engine + + (T... args) + + + T + operator() + cpp/numeric/random/shuffle_order_engine/operator() + + (T... args) + + + T + base + cpp/numeric/random/shuffle_order_engine/base + + (T... args) + + + T + seed + cpp/numeric/random/shuffle_order_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/shuffle_order_engine/min + + (T... args) + + + + std::auto_ptr + cpp/memory/auto_ptr + + T + release + cpp/memory/auto_ptr/release + + (T... args) + + + T + operator* + cpp/memory/auto_ptr/operator* + + (T... args) + + + T + operator auto_ptr<Y> + cpp/memory/auto_ptr/operator_auto_ptr + + (T... args) + + + T + reset + cpp/memory/auto_ptr/reset + + (T... args) + + + T + operator-> + cpp/memory/auto_ptr/operator* + + (T... args) + + + T + operator= + cpp/memory/auto_ptr/operator= + + (T... args) + + + T + auto_ptr + cpp/memory/auto_ptr/auto_ptr + + (T... args) + + + T + ~auto_ptr + cpp/memory/auto_ptr/~auto_ptr + + (T... args) + + + T + get + cpp/memory/auto_ptr/get + + (T... args) + + + + std::minstd_rand0 + cpp/numeric/random/linear_congruential_engine + + T + discard + cpp/numeric/random/linear_congruential_engine/discard + + (T... args) + + + T + max + cpp/numeric/random/linear_congruential_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/linear_congruential_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/linear_congruential_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/linear_congruential_engine/min + + (T... args) + + + T + minstd_rand0 + cpp/numeric/random/linear_congruential_engine/linear_congruential_engine + + (T... args) + + + + std::sregex_token_iterator + cpp/regex/regex_token_iterator + + T + operator!= + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator= + cpp/regex/regex_token_iterator/operator= + + (T... args) + + + T + sregex_token_iterator + cpp/regex/regex_token_iterator/regex_token_iterator + + (T... args) + + + T + operator== + cpp/regex/regex_token_iterator/operator_cmp + + (T... args) + + + T + operator-> + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++ + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + T + operator* + cpp/regex/regex_token_iterator/operator* + + (T... args) + + + T + operator++(int) + cpp/regex/regex_token_iterator/operator_arith + + (T... args) + + + + std::logical_not + cpp/utility/functional/logical_not + + T + operator() + cpp/utility/functional/logical_not + + (T... args) + + + + std::fpos_t + cpp/io/c + + + std::istream + cpp/io/basic_istream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + ~istream + cpp/io/basic_istream/~basic_istream + + (T... args) + + + T + istream + cpp/io/basic_istream/basic_istream + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::istream::event_callback + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::istream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + std::istream::sentry + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::istream::event_callback + cpp/io/ios_base/event_callback + + + std::istream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::istream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::seed_seq + cpp/numeric/random/seed_seq + + T + generate + cpp/numeric/random/seed_seq/generate + + (T... args) + + + T + param + cpp/numeric/random/seed_seq/param + + (T... args) + + + T + size + cpp/numeric/random/seed_seq/size + + (T... args) + + + T + seed_seq + cpp/numeric/random/seed_seq/seed_seq + + (T... args) + + + + std::default_delete + cpp/memory/default_delete + + T + default_delete + cpp/memory/default_delete + + (T... args) + + + T + operator() + cpp/memory/default_delete + + (T... args) + + + + std::femto + cpp/numeric/ratio/ratio + + + std::clock_t + cpp/chrono/c/clock_t + + + std::true_type + cpp/types/integral_constant + + + std::mbstate_t + cpp/string/multibyte/mbstate_t + + + std::ostrstream + cpp/io/ostrstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/ostrstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::ostrstream::event_callback + + T + pcount + cpp/io/ostrstream/pcount + + (T... args) + + + T + ostrstream + cpp/io/ostrstream/ostrstream + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::ostrstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + freeze + cpp/io/ostrstream/freeze + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + ~ostrstream + cpp/io/ostrstream/~ostrstream + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::ostrstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::ostrstream::event_callback + cpp/io/ios_base/event_callback + + + std::ostrstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ostrstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::gamma_distribution + cpp/numeric/random/gamma_distribution + + T + gamma_distribution + cpp/numeric/random/gamma_distribution/gamma_distribution + + (T... args) + + + T + max + cpp/numeric/random/gamma_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/gamma_distribution/operator() + + (T... args) + + + T + reset + cpp/numeric/random/gamma_distribution/reset + + (T... args) + + + T + alpha + cpp/numeric/random/gamma_distribution/params + + (T... args) + + + T + beta + cpp/numeric/random/gamma_distribution/params + + (T... args) + + + T + param + cpp/numeric/random/gamma_distribution/param + + (T... args) + + + T + min + cpp/numeric/random/gamma_distribution/min + + (T... args) + + + + std::bad_weak_ptr + cpp/memory/bad_weak_ptr + + T + bad_weak_ptr + cpp/memory/bad_weak_ptr/bad_weak_ptr + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::output_iterator_tag + cpp/iterator/iterator_tags + + + std::micro + cpp/numeric/ratio/ratio + + + std::is_trivial + cpp/types/is_trivial + + + std::packaged_task + cpp/thread/packaged_task + + T + operator= + cpp/thread/packaged_task/operator= + + (T... args) + + + T + swap + cpp/thread/packaged_task/swap + + (T... args) + + + T + reset + cpp/thread/packaged_task/reset + + (T... args) + + + T + packaged_task + cpp/thread/packaged_task/packaged_task + + (T... args) + + + T + make_ready_at_thread_exit + cpp/thread/packaged_task/make_ready_at_thread_exit + + (T... args) + + + T + operator() + cpp/thread/packaged_task/operator() + + (T... args) + + + T + get_future + cpp/thread/packaged_task/get_future + + (T... args) + + + T + valid + cpp/thread/packaged_task/valid + + (T... args) + + + T + ~packaged_task + cpp/thread/packaged_task/~packaged_task + + (T... args) + + + + std::unordered_set + cpp/container/unordered_set + + T + max_bucket_count + cpp/container/unordered_set/max_bucket_count + + (T... args) + + + T + cbegin + cpp/container/unordered_set/begin + + (T... args) + + + T + erase + cpp/container/unordered_set/erase + + (T... args) + + + T + insert + cpp/container/unordered_set/insert + + (T... args) + + + T + bucket_count + cpp/container/unordered_set/bucket_count + + (T... args) + + + T + max_load_factor + cpp/container/unordered_set/max_load_factor + + (T... args) + + + T + end + cpp/container/unordered_set/end + + (T... args) + + + T + emplace_hint + cpp/container/unordered_set/emplace_hint + + (T... args) + + + T + end(int) + cpp/container/unordered_set/end2 + + (T... args) + + + T + ~unordered_set + cpp/container/unordered_set/~unordered_set + + (T... args) + + + T + key_eq + cpp/container/unordered_set/key_eq + + (T... args) + + + T + hash_function + cpp/container/unordered_set/hash_function + + (T... args) + + + T + find + cpp/container/unordered_set/find + + (T... args) + + + T + clear + cpp/container/unordered_set/clear + + (T... args) + + + T + begin + cpp/container/unordered_set/begin + + (T... args) + + + T + cbegin(int) + cpp/container/unordered_set/begin2 + + (T... args) + + + T + swap + cpp/container/unordered_set/swap + + (T... args) + + + T + begin(int) + cpp/container/unordered_set/begin2 + + (T... args) + + + T + load_factor + cpp/container/unordered_set/load_factor + + (T... args) + + + T + size + cpp/container/unordered_set/size + + (T... args) + + + T + operator= + cpp/container/unordered_set/operator= + + (T... args) + + + T + cend + cpp/container/unordered_set/end + + (T... args) + + + T + reserve + cpp/container/unordered_set/reserve + + (T... args) + + + T + rehash + cpp/container/unordered_set/rehash + + (T... args) + + + T + bucket + cpp/container/unordered_set/bucket + + (T... args) + + + T + empty + cpp/container/unordered_set/empty + + (T... args) + + + T + get_allocator + cpp/container/unordered_set/get_allocator + + (T... args) + + + T + max_size + cpp/container/unordered_set/max_size + + (T... args) + + + T + cend(int) + cpp/container/unordered_set/end2 + + (T... args) + + + T + count + cpp/container/unordered_set/count + + (T... args) + + + T + unordered_set + cpp/container/unordered_set/unordered_set + + (T... args) + + + T + equal_range + cpp/container/unordered_set/equal_range + + (T... args) + + + T + emplace + cpp/container/unordered_set/emplace + + (T... args) + + + T + bucket_size + cpp/container/unordered_set/bucket_size + + (T... args) + + + + std::is_volatile + cpp/types/is_volatile + + + std::wfstream + cpp/io/basic_fstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + open + cpp/io/basic_fstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::wfstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + wfstream + cpp/io/basic_fstream/basic_fstream + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::wfstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + close + cpp/io/basic_fstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wfstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_fstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_fstream/operator= + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wfstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::wfstream::event_callback + cpp/io/ios_base/event_callback + + + std::wfstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::multimap + cpp/container/multimap + + T + multimap + cpp/container/multimap/multimap + + (T... args) + + + T + begin + cpp/container/multimap/begin + + (T... args) + + + T + erase + cpp/container/multimap/erase + + (T... args) + + + T + insert + cpp/container/multimap/insert + + (T... args) + + + T + swap + cpp/container/multimap/swap + + (T... args) + + + T + end + cpp/container/multimap/end + + (T... args) + + + T + ~multimap + cpp/container/multimap/~multimap + + (T... args) + + + T + emplace_hint + cpp/container/multimap/emplace_hint + + (T... args) + + + T + key_comp + cpp/container/multimap/key_comp + + (T... args) + + std::multimap::value_compare + + T + cbegin + cpp/container/multimap/begin + + (T... args) + + + T + count + cpp/container/multimap/count + + (T... args) + + + T + find + cpp/container/multimap/find + + (T... args) + + + T + crbegin + cpp/container/multimap/rbegin + + (T... args) + + + T + upper_bound + cpp/container/multimap/upper_bound + + (T... args) + + + T + rbegin + cpp/container/multimap/rbegin + + (T... args) + + + T + crend + cpp/container/multimap/rend + + (T... args) + + + T + size + cpp/container/multimap/size + + (T... args) + + + T + operator= + cpp/container/multimap/operator= + + (T... args) + + + T + value_comp + cpp/container/multimap/value_comp + + (T... args) + + + T + empty + cpp/container/multimap/empty + + (T... args) + + + T + lower_bound + cpp/container/multimap/lower_bound + + (T... args) + + + T + cend + cpp/container/multimap/end + + (T... args) + + + T + max_size + cpp/container/multimap/max_size + + (T... args) + + + T + rend + cpp/container/multimap/rend + + (T... args) + + + T + get_allocator + cpp/container/multimap/get_allocator + + (T... args) + + + T + clear + cpp/container/multimap/clear + + (T... args) + + + T + equal_range + cpp/container/multimap/equal_range + + (T... args) + + + T + emplace + cpp/container/multimap/emplace + + (T... args) + + + + std::multimap::value_compare + cpp/container/multimap/value_compare + + + std::atomic_flag + cpp/atomic/atomic_flag + + T + operator= + cpp/atomic/atomic_flag/operator= + + (T... args) + + + T + clear + cpp/atomic/atomic_flag/clear + + (T... args) + + + T + atomic_flag + cpp/atomic/atomic_flag/atomic_flag + + (T... args) + + + T + test_and_set + cpp/atomic/atomic_flag/test_and_set + + (T... args) + + + + std::numpunct_byname + cpp/locale/numpunct_byname + + T + grouping + cpp/locale/numpunct/grouping + + (T... args) + + + T + do_decimal_point + cpp/locale/numpunct/decimal_point + + (T... args) + + + T + thousands_sep + cpp/locale/numpunct/thousands_sep + + (T... args) + + + T + falsename + cpp/locale/numpunct/truefalsename + + (T... args) + + + T + do_falsename + cpp/locale/numpunct/truefalsename + + (T... args) + + std::numpunct_byname::string_type + + T + numpunct_byname + cpp/locale/numpunct_byname + + (T... args) + + + T + truename + cpp/locale/numpunct/truefalsename + + (T... args) + + std::numpunct_byname::char_type + + T + do_truename + cpp/locale/numpunct/truefalsename + + (T... args) + + + T + do_grouping + cpp/locale/numpunct/grouping + + (T... args) + + + T + decimal_point + cpp/locale/numpunct/decimal_point + + (T... args) + + + T + do_thousands_sep + cpp/locale/numpunct/thousands_sep + + (T... args) + + + T + ~numpunct_byname + cpp/locale/numpunct_byname + + (T... args) + + + + std::numpunct_byname::string_type + cpp/locale/numpunct + + + std::numpunct_byname::char_type + cpp/locale/numpunct + + + std::binomial_distribution + cpp/numeric/random/binomial_distribution + + T + t + cpp/numeric/random/binomial_distribution/params + + (T... args) + + + T + binomial_distribution + cpp/numeric/random/binomial_distribution/binomial_distribution + + (T... args) + + + T + reset + cpp/numeric/random/binomial_distribution/reset + + (T... args) + + + T + max + cpp/numeric/random/binomial_distribution/max + + (T... args) + + + T + p + cpp/numeric/random/binomial_distribution/params + + (T... args) + + + T + min + cpp/numeric/random/binomial_distribution/min + + (T... args) + + + T + param + cpp/numeric/random/binomial_distribution/param + + (T... args) + + + + std::basic_iostream + cpp/io/basic_iostream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + ~basic_iostream + cpp/io/basic_iostream/~basic_iostream + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::basic_iostream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::basic_iostream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + basic_iostream + cpp/io/basic_iostream/basic_iostream + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::basic_iostream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::basic_iostream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::basic_iostream::event_callback + cpp/io/ios_base/event_callback + + + std::basic_iostream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wofstream + cpp/io/basic_ofstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + std::wofstream::event_callback + + T + open + cpp/io/basic_ofstream/open + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + wofstream + cpp/io/basic_ofstream/basic_ofstream + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ofstream/close + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wofstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ofstream/is_open + + (T... args) + + + T + operator= + cpp/io/basic_ofstream/operator= + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + std::wofstream::sentry + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wofstream::event_callback + cpp/io/ios_base/event_callback + + + std::wofstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wofstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_ostream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_ostream/sentry + + (T... args) + + + + std::fpos + cpp/io/fpos + + T + state + cpp/io/fpos/state + + (T... args) + + + + std::underflow_error + cpp/error/underflow_error + + T + underflow_error + cpp/error/underflow_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::cauchy_distribution + cpp/numeric/random/cauchy_distribution + + T + min + cpp/numeric/random/cauchy_distribution/min + + (T... args) + + + T + reset + cpp/numeric/random/cauchy_distribution/reset + + (T... args) + + + T + a + cpp/numeric/random/cauchy_distribution/params + + (T... args) + + + T + max + cpp/numeric/random/cauchy_distribution/max + + (T... args) + + + T + operator() + cpp/numeric/random/cauchy_distribution/operator() + + (T... args) + + + T + param + cpp/numeric/random/cauchy_distribution/param + + (T... args) + + + T + cauchy_distribution + cpp/numeric/random/cauchy_distribution/cauchy_distribution + + (T... args) + + + T + b + cpp/numeric/random/cauchy_distribution/params + + (T... args) + + + + std::is_trivially_copy_constructible + cpp/types/is_copy_constructible + + + std::conditional + cpp/types/conditional + + + std::is_pod + cpp/types/is_pod + + + std::int_least8_t + cpp/types/integer + + + std::streamoff + cpp/io/streamoff + + + std::is_move_assignable + cpp/types/is_move_assignable + + + std::int_least32_t + cpp/types/integer + + + std::wstringstream + cpp/io/basic_stringstream + + T + seekp + cpp/io/basic_ostream/seekp + + (T... args) + + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_stringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + tellp + cpp/io/basic_ostream/tellp + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + std::wstringstream::sentry + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + operator<< + cpp/io/basic_ostream/operator_ltlt + + (T... args) + + std::wstringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + write + cpp/io/basic_ostream/write + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + std::wstringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + flush + cpp/io/basic_ostream/flush + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_stringstream/operator= + + (T... args) + + + T + wstringstream + cpp/io/basic_stringstream/basic_stringstream + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + put + cpp/io/basic_ostream/put + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wstringstream::sentry + cpp/io/basic_ostream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::wstringstream::event_callback + cpp/io/ios_base/event_callback + + + std::wstringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::subtract_with_carry_engine + cpp/numeric/random/subtract_with_carry_engine + + T + discard + cpp/numeric/random/subtract_with_carry_engine/discard + + (T... args) + + + T + subtract_with_carry_engine + cpp/numeric/random/subtract_with_carry_engine/subtract_with_carry_engine + + (T... args) + + + T + max + cpp/numeric/random/subtract_with_carry_engine/max + + (T... args) + + + T + operator() + cpp/numeric/random/subtract_with_carry_engine/operator() + + (T... args) + + + T + seed + cpp/numeric/random/subtract_with_carry_engine/seed + + (T... args) + + + T + min + cpp/numeric/random/subtract_with_carry_engine/min + + (T... args) + + + + std::regex_error + cpp/regex/regex_error + + T + code + cpp/regex/regex_error/code + + (T... args) + + + T + regex_error + cpp/regex/regex_error/regex_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::is_constructible + cpp/types/is_constructible + + + std::piecewise_construct_t + cpp/utility/piecewise_construct_t + + + std::mutex + cpp/thread/mutex + + T + mutex + cpp/thread/mutex/mutex + + (T... args) + + + T + unlock + cpp/thread/mutex/unlock + + (T... args) + + + T + lock + cpp/thread/mutex/lock + + (T... args) + + + T + try_lock + cpp/thread/mutex/try_lock + + (T... args) + + + T + native_handle + cpp/thread/mutex/native_handle + + (T... args) + + + + std::system_error + cpp/error/system_error + + T + code + cpp/error/system_error/code + + (T... args) + + + T + system_error + cpp/error/system_error/system_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wistringstream + cpp/io/basic_istringstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + str + cpp/io/basic_istringstream/str + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + wistringstream + cpp/io/basic_istringstream/basic_istringstream + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::wistringstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::wistringstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_istringstream/operator= + + (T... args) + + std::wistringstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::wistringstream::event_callback + cpp/io/ios_base/event_callback + + + std::wistringstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::wistringstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::is_floating_point + cpp/types/is_floating_point + + + std::ratio_not_equal + cpp/numeric/ratio/ratio_not_equal + + + std::ratio_multiply + cpp/numeric/ratio/ratio_multiply + + + std::result_of + cpp/types/result_of + + + std::is_fundamental + cpp/types/is_fundamental + + + std::ifstream + cpp/io/basic_ifstream + + T + setstate + cpp/io/basic_ios/setstate + + (T... args) + + + T + getloc + cpp/io/ios_base/getloc + + (T... args) + + + T + precision + cpp/io/ios_base/precision + + (T... args) + + + T + flags + cpp/io/ios_base/flags + + (T... args) + + + T + widen + cpp/io/basic_ios/widen + + (T... args) + + + T + readsome + cpp/io/basic_istream/readsome + + (T... args) + + + T + fill + cpp/io/basic_ios/fill + + (T... args) + + + T + setf + cpp/io/ios_base/setf + + (T... args) + + + T + tie + cpp/io/basic_ios/tie + + (T... args) + + + T + open + cpp/io/basic_ifstream/open + + (T... args) + + + T + operator bool + cpp/io/basic_ios/operator_bool + + (T... args) + + + T + copyfmt + cpp/io/basic_ios/copyfmt + + (T... args) + + + T + sync_with_stdio + cpp/io/ios_base/sync_with_stdio + + (T... args) + + + T + gcount + cpp/io/basic_istream/gcount + + (T... args) + + + T + get + cpp/io/basic_istream/get + + (T... args) + + + T + xalloc + cpp/io/ios_base/xalloc + + (T... args) + + + T + read + cpp/io/basic_istream/read + + (T... args) + + + T + getline + cpp/io/basic_istream/getline + + (T... args) + + + T + exceptions + cpp/io/basic_ios/exceptions + + (T... args) + + + T + iword + cpp/io/ios_base/iword + + (T... args) + + + T + unget + cpp/io/basic_istream/unget + + (T... args) + + std::ifstream::event_callback + + T + narrow + cpp/io/basic_ios/narrow + + (T... args) + + + T + ifstream + cpp/io/basic_ifstream/basic_ifstream + + (T... args) + + + T + good + cpp/io/basic_ios/good + + (T... args) + + + T + operator! + cpp/io/basic_ios/operator! + + (T... args) + + + T + close + cpp/io/basic_ifstream/close + + (T... args) + + + T + sync + cpp/io/basic_istream/sync + + (T... args) + + + T + putback + cpp/io/basic_istream/putback + + (T... args) + + + T + ignore + cpp/io/basic_istream/ignore + + (T... args) + + + T + unsetf + cpp/io/ios_base/unsetf + + (T... args) + + + T + width + cpp/io/ios_base/width + + (T... args) + + + T + rdstate + cpp/io/basic_ios/rdstate + + (T... args) + + + T + seekg + cpp/io/basic_istream/seekg + + (T... args) + + std::ifstream::failure + + T + move + cpp/io/basic_ios/move + + (T... args) + + + T + eof + cpp/io/basic_ios/eof + + (T... args) + + + T + register_callback + cpp/io/ios_base/register_callback + + (T... args) + + + T + pword + cpp/io/ios_base/pword + + (T... args) + + + T + swap + cpp/io/basic_ios/swap + + (T... args) + + + T + tellg + cpp/io/basic_istream/tellg + + (T... args) + + + T + operator>> + cpp/io/basic_istream/operator_gtgt + + (T... args) + + + T + set_rdbuf + cpp/io/basic_ios/set_rdbuf + + (T... args) + + + T + fail + cpp/io/basic_ios/fail + + (T... args) + + + T + is_open + cpp/io/basic_ifstream/is_open + + (T... args) + + + T + peek + cpp/io/basic_istream/peek + + (T... args) + + + T + operator= + cpp/io/basic_ifstream/operator= + + (T... args) + + std::ifstream::sentry + + T + rdbuf + cpp/io/basic_ios/rdbuf + + (T... args) + + + T + imbue + cpp/io/basic_ios/imbue + + (T... args) + + + T + bad + cpp/io/basic_ios/bad + + (T... args) + + + T + clear + cpp/io/basic_ios/clear + + (T... args) + + + T + init + cpp/io/basic_ios/init + + (T... args) + + + + std::ifstream::event_callback + cpp/io/ios_base/event_callback + + + std::ifstream::failure + cpp/io/ios_base/failure + + T + failure + cpp/io/ios_base/failure + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::ifstream::sentry + cpp/io/basic_istream/sentry + + T + ~sentry + cpp/io/basic_istream/sentry + + (T... args) + + + T + operator bool + cpp/io/basic_istream/sentry + + (T... args) + + + T + sentry + cpp/io/basic_istream/sentry + + (T... args) + + + + std::u32streampos + cpp/io/fpos + + T + state + cpp/io/fpos/state + + (T... args) + + + + std::length_error + cpp/error/length_error + + T + length_error + cpp/error/length_error + + (T... args) + + + T + what + cpp/error/exception/what + + (T... args) + + + + std::sub_match + cpp/regex/sub_match + + T + operator string_type + cpp/regex/sub_match/str + + (T... args) + + + T + sub_match + cpp/regex/sub_match/sub_match + + (T... args) + + + T + str + cpp/regex/sub_match/str + + (T... args) + + + T + length + cpp/regex/sub_match/length + + (T... args) + + + T + compare + cpp/regex/sub_match/compare + + (T... args) + + + + std::common_type + cpp/types/common_type + + + std::shared_timed_mutex + cpp/thread/shared_timed_mutex + + T + unlock + cpp/thread/shared_timed_mutex/unlock + + (T... args) + + + T + unlock_shared + cpp/thread/shared_timed_mutex/unlock_shared + + (T... args) + + + T + try_lock_until + cpp/thread/shared_timed_mutex/try_lock_until + + (T... args) + + + T + try_lock_for + cpp/thread/shared_timed_mutex/try_lock_for + + (T... args) + + + T + try_lock_shared_until + cpp/thread/shared_timed_mutex/try_lock_shared_until + + (T... args) + + + T + shared_timed_mutex + cpp/thread/shared_timed_mutex/shared_timed_mutex + + (T... args) + + + T + lock_shared + cpp/thread/shared_timed_mutex/lock_shared + + (T... args) + + + T + lock + cpp/thread/shared_timed_mutex/lock + + (T... args) + + + T + try_lock + cpp/thread/shared_timed_mutex/try_lock + + (T... args) + + + T + try_lock_shared + cpp/thread/shared_timed_mutex/try_lock_shared + + (T... args) + + + T + try_lock_shared_for + cpp/thread/shared_timed_mutex/try_lock_shared_for + + (T... args) + + + + std::array + cpp/container/array + + T + max_size + cpp/container/array/max_size + + (T... args) + + + T + rbegin + cpp/container/array/rbegin + + (T... args) + + + T + crend + cpp/container/array/rend + + (T... args) + + + T + crbegin + cpp/container/array/rbegin + + (T... args) + + + T + swap + cpp/container/array/swap + + (T... args) + + + T + data + cpp/container/array/data + + (T... args) + + + T + back + cpp/container/array/back + + (T... args) + + + T + end + cpp/container/array/end + + (T... args) + + + T + fill + cpp/container/array/fill + + (T... args) + + + T + empty + cpp/container/array/empty + + (T... args) + + + T + cend + cpp/container/array/end + + (T... args) + + + T + size + cpp/container/array/size + + (T... args) + + + T + cbegin + cpp/container/array/begin + + (T... args) + + + T + rend + cpp/container/array/rend + + (T... args) + + + T + front + cpp/container/array/front + + (T... args) + + + T + at + cpp/container/array/at + + (T... args) + + + T + operator[] + cpp/container/array/operator_at + + (T... args) + + + T + begin + cpp/container/array/begin + + (T... args) + + + + std::random_device + cpp/numeric/random/random_device + + T + operator() + cpp/numeric/random/random_device/operator() + + (T... args) + + + T + random_device + cpp/numeric/random/random_device/random_device + + (T... args) + + + T + entropy + cpp/numeric/random/random_device/entropy + + (T... args) + + + T + min + cpp/numeric/random/random_device/min + + (T... args) + + + T + max + cpp/numeric/random/random_device/max + + (T... args) + + + + std::default_random_engine + cpp/numeric/random + + + std::raw_storage_iterator + cpp/memory/raw_storage_iterator + + T + operator= + cpp/memory/raw_storage_iterator/operator= + + (T... args) + + + T + raw_storage_iterator + cpp/memory/raw_storage_iterator/raw_storage_iterator + + (T... args) + + + T + operator* + cpp/memory/raw_storage_iterator/operator* + + (T... args) + + + T + operator++ + cpp/memory/raw_storage_iterator/operator_arith + + (T... args) + + + + std::is_convertible + cpp/types/is_convertible + + + std::uint16_t + cpp/types/integer + + + std::is_array + cpp/types/is_array + + + std::mega + cpp/numeric/ratio/ratio + + + std::numpunct + cpp/locale/numpunct + + T + grouping + cpp/locale/numpunct/grouping + + (T... args) + + + T + do_decimal_point + cpp/locale/numpunct/decimal_point + + (T... args) + + + T + thousands_sep + cpp/locale/numpunct/thousands_sep + + (T... args) + + + T + numpunct + cpp/locale/numpunct/numpunct + + (T... args) + + + T + do_falsename + cpp/locale/numpunct/truefalsename + + (T... args) + + std::numpunct::string_type + + T + do_grouping + cpp/locale/numpunct/grouping + + (T... args) + + + T + truename + cpp/locale/numpunct/truefalsename + + (T... args) + + std::numpunct::char_type + + T + falsename + cpp/locale/numpunct/truefalsename + + (T... args) + + + T + do_truename + cpp/locale/numpunct/truefalsename + + (T... args) + + + T + ~numpunct + cpp/locale/numpunct/~numpunct + + (T... args) + + + T + decimal_point + cpp/locale/numpunct/decimal_point + + (T... args) + + + T + do_thousands_sep + cpp/locale/numpunct/thousands_sep + + (T... args) + + + + std::numpunct::string_type + cpp/locale/numpunct + + + std::numpunct::char_type + cpp/locale/numpunct + + + std::money_put + cpp/locale/money_put + std::money_put::char_type + std::money_put::pattern + + T + do_put + cpp/locale/money_put/put + + (T... args) + + + T + money_put + cpp/locale/money_put/money_put + + (T... args) + + + T + ~money_put + cpp/locale/money_put/~money_put + + (T... args) + + + T + put + cpp/locale/money_put/put + + (T... args) + + std::money_put::string_type + std::money_put::iter_type + + + std::money_put::char_type + cpp/locale/money_put + + + std::money_put::pattern + cpp/locale/money_base + + + std::money_put::string_type + cpp/locale/money_put + + + std::money_put::iter_type + cpp/locale/money_put + + + std::new_handler + cpp/memory/new/new_handler + + + std::is_member_function_pointer + cpp/types/is_member_function_pointer + + + va_list + cpp/utility/variadic/va_list + + diff --git a/dynamic_programming/0-1 Knapsack.cpp b/dynamic_programming/0-1 Knapsack.cpp deleted file mode 100644 index 9348372b2..000000000 --- a/dynamic_programming/0-1 Knapsack.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//0-1 Knapsack problem - Dynamic programming -//#include -#include -using namespace std; - -//void Print(int res[20][20], int i, int j, int capacity) -//{ -// if(i==0 || j==0) -// { -// return; -// } -// if(res[i-1][j]==res[i][j-1]) -// { -// if(i<=capacity) -// { -// cout<res[i][j-1]) -// { -// Print(res, i-1,j, capacity); -// } -// else if(res[i][j-1]>res[i-1][j]) -// { -// Print(res, i,j-1, capacity); -// } -//} - -int Knapsack(int capacity, int n, int weight[], int value[]) -{ - int res[20][20]; - for (int i = 0; i < n + 1; ++i) - { - for (int j = 0; j < capacity + 1; ++j) - { - if (i == 0 || j == 0) - res[i][j] = 0; - else if (weight[i - 1] <= j) - res[i][j] = max(value[i - 1] + res[i - 1][j - weight[i - 1]], res[i - 1][j]); - else - res[i][j] = res[i - 1][j]; - } - } - // Print(res, n, capacity, capacity); - // cout<<"\n"; - return res[n][capacity]; -} -int main() -{ - int n; - cout << "Enter number of items: "; - cin >> n; - int weight[n], value[n]; - cout << "Enter weights: "; - for (int i = 0; i < n; ++i) - { - cin >> weight[i]; - } - cout << "Enter values: "; - for (int i = 0; i < n; ++i) - { - cin >> value[i]; - } - int capacity; - cout << "Enter capacity: "; - cin >> capacity; - cout << Knapsack(capacity, n, weight, value); - return 0; -} diff --git a/dynamic_programming/0_1_knapsack.cpp b/dynamic_programming/0_1_knapsack.cpp new file mode 100644 index 000000000..7ea0c04c6 --- /dev/null +++ b/dynamic_programming/0_1_knapsack.cpp @@ -0,0 +1,66 @@ +// 0-1 Knapsack problem - Dynamic programming +//#include +#include +using namespace std; + +// void Print(int res[20][20], int i, int j, int capacity) +//{ +// if(i==0 || j==0) +// { +// return; +// } +// if(res[i-1][j]==res[i][j-1]) +// { +// if(i<=capacity) +// { +// cout<res[i][j-1]) +// { +// Print(res, i-1,j, capacity); +// } +// else if(res[i][j-1]>res[i-1][j]) +// { +// Print(res, i,j-1, capacity); +// } +//} + +int Knapsack(int capacity, int n, int weight[], int value[]) { + int res[20][20]; + for (int i = 0; i < n + 1; ++i) { + for (int j = 0; j < capacity + 1; ++j) { + if (i == 0 || j == 0) + res[i][j] = 0; + else if (weight[i - 1] <= j) + res[i][j] = max(value[i - 1] + res[i - 1][j - weight[i - 1]], + res[i - 1][j]); + else + res[i][j] = res[i - 1][j]; + } + } + // Print(res, n, capacity, capacity); + // cout<<"\n"; + return res[n][capacity]; +} +int main() { + int n; + cout << "Enter number of items: "; + cin >> n; + int weight[n], value[n]; + cout << "Enter weights: "; + for (int i = 0; i < n; ++i) { + cin >> weight[i]; + } + cout << "Enter values: "; + for (int i = 0; i < n; ++i) { + cin >> value[i]; + } + int capacity; + cout << "Enter capacity: "; + cin >> capacity; + cout << Knapsack(capacity, n, weight, value); + return 0; +} diff --git a/dynamic_programming/Bellman-Ford.cpp b/dynamic_programming/Bellman-Ford.cpp deleted file mode 100644 index 7c36d96df..000000000 --- a/dynamic_programming/Bellman-Ford.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include - -using namespace std; - -//Wrapper class for storing an edge -class Edge -{ -public: - int src, dst, weight; -}; - -//Wrapper class for storing a graph -class Graph -{ -public: - int vertexNum, edgeNum; - Edge *edges; - - //Constructs a graph with V vertices and E edges - Graph(int V, int E) - { - this->vertexNum = V; - this->edgeNum = E; - this->edges = (Edge *)malloc(E * sizeof(Edge)); - } - - //Adds the given edge to the graph - void addEdge(int src, int dst, int weight) - { - static int edgeInd = 0; - if (edgeInd < this->edgeNum) - { - Edge newEdge; - newEdge.src = src; - newEdge.dst = dst; - newEdge.weight = weight; - this->edges[edgeInd++] = newEdge; - } - } -}; - -//Utility function to print distances -void print(int dist[], int V) -{ - cout << "\nVertex Distance" << endl; - for (int i = 0; i < V; i++) - { - if (dist[i] != INT_MAX) - cout << i << "\t" << dist[i] << endl; - else - cout << i << "\tINF" << endl; - } -} - -//The main function that finds the shortest path from given source -//to all other vertices using Bellman-Ford.It also detects negative -//weight cycle -void BellmanFord(Graph graph, int src) -{ - int V = graph.vertexNum; - int E = graph.edgeNum; - int dist[V]; - - //Initialize distances array as INF for all except source - //Intialize source as zero - for (int i = 0; i < V; i++) - dist[i] = INT_MAX; - dist[src] = 0; - - //Calculate shortest path distance from source to all edges - //A path can contain maximum (|V|-1) edges - for (int i = 0; i <= V - 1; i++) - for (int j = 0; j < E; j++) - { - int u = graph.edges[j].src; - int v = graph.edges[j].dst; - int w = graph.edges[j].weight; - - if (dist[u] != INT_MAX && dist[u] + w < dist[v]) - dist[v] = dist[u] + w; - } - - //Iterate inner loop once more to check for negative cycle - for (int j = 0; j < E; j++) - { - int u = graph.edges[j].src; - int v = graph.edges[j].dst; - int w = graph.edges[j].weight; - - if (dist[u] != INT_MAX && dist[u] + w < dist[v]) - { - cout << "Graph contains negative weight cycle. Hence, shortest distance not guaranteed." << endl; - return; - } - } - - print(dist, V); - - return; -} - -//Driver Function -int main() -{ - int V, E, gsrc; - int src, dst, weight; - cout << "Enter number of vertices: "; - cin >> V; - cout << "Enter number of edges: "; - cin >> E; - Graph G(V, E); - for (int i = 0; i < E; i++) - { - cout << "\nEdge " << i + 1 << "\nEnter source: "; - cin >> src; - cout << "Enter destination: "; - cin >> dst; - cout << "Enter weight: "; - cin >> weight; - G.addEdge(src, dst, weight); - } - cout << "\nEnter source: "; - cin >> gsrc; - BellmanFord(G, gsrc); - - return 0; -} diff --git a/dynamic_programming/Coin-Change.cpp b/dynamic_programming/Coin-Change.cpp deleted file mode 100644 index c8acad48e..000000000 --- a/dynamic_programming/Coin-Change.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -using namespace std; - -// Function to find the Minimum number of coins required to get Sum S -int findMinCoins(int arr[], int n, int N) -{ - // dp[i] = no of coins required to get a total of i - int dp[N + 1]; - - // 0 coins are needed for 0 sum - - dp[0] = 0; - - for (int i = 1; i <= N; i++) - { - // initialize minimum number of coins needed to infinity - dp[i] = INT_MAX; - int res = INT_MAX; - - // do for each coin - for (int c = 0; c < n; c++) - { - if (i - arr[c] >= 0) // check if coins doesn't become negative by including it - res = dp[i - arr[c]]; - - // if total can be reached by including current coin c, - // update minimum number of coins needed dp[i] - if (res != INT_MAX) - dp[i] = min(dp[i], res + 1); - } - } - - // The Minimum No of Coins Required for N = dp[N] - return dp[N]; -} - -int main() -{ - // No of Coins We Have - int arr[] = {1, 2, 3, 4}; - int n = sizeof(arr) / sizeof(arr[0]); - - // Total Change Required - int N = 15; - - cout << "Minimum Number of Coins Required " << findMinCoins(arr, n, N) << "\n"; - - return 0; -} \ No newline at end of file diff --git a/dynamic_programming/Cut Rod.cpp b/dynamic_programming/Cut Rod.cpp deleted file mode 100644 index afca3dced..000000000 --- a/dynamic_programming/Cut Rod.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*Given a rod of length n inches and an array of prices that -contains prices of all pieces of size smaller than n. Determine -the maximum value obtainable by cutting up the rod and selling -the pieces.*/ - -#include -using namespace std; -int cutrod(int p[], int n) -{ - int r[n + 1]; - r[0] = 0; - for (int j = 0; j < n; j++) - { - int q = INT_MIN; - for (int i = 0; i <= j; i++) - { - q = max(q, p[i] + r[j - i]); - } - r[j + 1] = q; - } - return r[n]; -} -int main() -{ - int price[] = {1, 5, 8, 9, 10, 17, 17, 20, 24, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}; - cout << cutrod(price, 30); - return 0; -} diff --git a/dynamic_programming/Fibonacci_Bottom_Up.cpp b/dynamic_programming/Fibonacci_Bottom_Up.cpp deleted file mode 100644 index ab5b5b41f..000000000 --- a/dynamic_programming/Fibonacci_Bottom_Up.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using namespace std; -int fib(int n) -{ - int res[3]; - res[0] = 0; - res[1] = 1; - for (int i = 2; i <= n; i++) - { - res[2] = res[1] + res[0]; - res[0] = res[1]; - res[1] = res[2]; - } - return res[1]; -} -int main(int argc, char const *argv[]) -{ - int n; - cout << "Enter n: "; - cin >> n; - cout << "Fibonacci number is "; - cout << fib(n) << endl; - return 0; -} diff --git a/dynamic_programming/Fibonacci_Top_Down.cpp b/dynamic_programming/Fibonacci_Top_Down.cpp deleted file mode 100644 index 9d76366f7..000000000 --- a/dynamic_programming/Fibonacci_Top_Down.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -using namespace std; -int arr[1000000]; -int fib(int n) -{ - if (arr[n] == -1) - { - if (n <= 1) - arr[n] = n; - else - arr[n] = fib(n - 1) + fib(n - 2); - } - return arr[n]; -} -int main(int argc, char const *argv[]) -{ - int n; - cout << "Enter n: "; - cin >> n; - for (int i = 0; i < n + 1; ++i) - { - arr[i] = -1; - } - cout << "Fibonacci number is " << fib(n) << endl; - return 0; -} \ No newline at end of file diff --git a/dynamic_programming/Floyd-Warshall.cpp b/dynamic_programming/Floyd-Warshall.cpp deleted file mode 100644 index 93ccff62f..000000000 --- a/dynamic_programming/Floyd-Warshall.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include -#include - -using namespace std; - -//Wrapper class for storing a graph -class Graph -{ -public: - int vertexNum; - int **edges; - - //Constructs a graph with V vertices and E edges - Graph(int V) - { - this->vertexNum = V; - this->edges = (int **)malloc(V * sizeof(int *)); - for (int i = 0; i < V; i++) - { - this->edges[i] = (int *)malloc(V * sizeof(int)); - for (int j = 0; j < V; j++) - this->edges[i][j] = INT_MAX; - this->edges[i][i] = 0; - } - } - - //Adds the given edge to the graph - void addEdge(int src, int dst, int weight) - { - this->edges[src][dst] = weight; - } -}; - -//Utility function to print distances -void print(int dist[], int V) -{ - cout << "\nThe Distance matrix for Floyd - Warshall" << endl; - for (int i = 0; i < V; i++) - { - for (int j = 0; j < V; j++) - { - - if (dist[i * V + j] != INT_MAX) - cout << dist[i * V + j] << "\t"; - else - cout << "INF" - << "\t"; - } - cout << endl; - } -} - -//The main function that finds the shortest path from a vertex -//to all other vertices using Floyd-Warshall Algorithm. -void FloydWarshall(Graph graph) -{ - int V = graph.vertexNum; - int dist[V][V]; - - //Initialise distance array - for (int i = 0; i < V; i++) - for (int j = 0; j < V; j++) - dist[i][j] = graph.edges[i][j]; - - //Calculate distances - for (int k = 0; k < V; k++) - //Choose an intermediate vertex - - for (int i = 0; i < V; i++) - //Choose a source vertex for given intermediate - - for (int j = 0; j < V; j++) - //Choose a destination vertex for above source vertex - - if (dist[i][k] != INT_MAX && dist[k][j] != INT_MAX && dist[i][k] + dist[k][j] < dist[i][j]) - //If the distance through intermediate vertex is less than direct edge then update value in distance array - dist[i][j] = dist[i][k] + dist[k][j]; - - //Convert 2d array to 1d array for print - int dist1d[V * V]; - for (int i = 0; i < V; i++) - for (int j = 0; j < V; j++) - dist1d[i * V + j] = dist[i][j]; - - print(dist1d, V); -} - -//Driver Function -int main() -{ - int V, E; - int src, dst, weight; - cout << "Enter number of vertices: "; - cin >> V; - cout << "Enter number of edges: "; - cin >> E; - Graph G(V); - for (int i = 0; i < E; i++) - { - cout << "\nEdge " << i + 1 << "\nEnter source: "; - cin >> src; - cout << "Enter destination: "; - cin >> dst; - cout << "Enter weight: "; - cin >> weight; - G.addEdge(src, dst, weight); - } - FloydWarshall(G); - - return 0; -} diff --git a/dynamic_programming/Longest Common Subsequence.cpp b/dynamic_programming/Longest Common Subsequence.cpp deleted file mode 100644 index af50720b4..000000000 --- a/dynamic_programming/Longest Common Subsequence.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//Longest common subsequence - Dynamic Programming -#include -using namespace std; - -void Print(int trace[20][20], int m, int n, string a) -{ - if (m == 0 || n == 0) - { - return; - } - if (trace[m][n] == 1) - { - Print(trace, m - 1, n - 1, a); - cout << a[m - 1]; - } - else if (trace[m][n] == 2) - { - Print(trace, m - 1, n, a); - } - else if (trace[m][n] == 3) - { - Print(trace, m, n - 1, a); - } -} - -int lcs(string a, string b) -{ - int m = a.length(), n = b.length(); - int res[m + 1][n + 1]; - int trace[20][20]; - - // fills up the arrays with zeros. - for (int i = 0; i < m + 1; i++) - { - for (int j = 0; j < n + 1; j++) - { - res[i][j] = 0; - trace[i][j] = 0; - } - } - - for (int i = 0; i < m + 1; ++i) - { - for (int j = 0; j < n + 1; ++j) - { - if (i == 0 || j == 0) - { - res[i][j] = 0; - trace[i][j] = 0; - } - - else if (a[i - 1] == b[j - 1]) - { - res[i][j] = 1 + res[i - 1][j - 1]; - trace[i][j] = 1; // 1 means trace the matrix in upper left diagonal direction. - } - else - { - if (res[i - 1][j] > res[i][j - 1]) - { - res[i][j] = res[i - 1][j]; - trace[i][j] = 2; // 2 means trace the matrix in upwards direction. - } - else - { - res[i][j] = res[i][j - 1]; - trace[i][j] = 3; // means trace the matrix in left direction. - } - } - } - } - Print(trace, m, n, a); - return res[m][n]; -} - -int main() -{ - string a, b; - cin >> a >> b; - cout << lcs(a, b); - return 0; -} diff --git a/dynamic_programming/Longest Increasing Subsequence (nlogn).cpp b/dynamic_programming/Longest Increasing Subsequence (nlogn).cpp deleted file mode 100644 index 5ee24e6a7..000000000 --- a/dynamic_programming/Longest Increasing Subsequence (nlogn).cpp +++ /dev/null @@ -1,46 +0,0 @@ -//Program to calculate length of longest increasing subsequence in an array -// in O(n log n) -// tested on : https://cses.fi/problemset/task/1145/ - -#include - -using namespace std; -int LIS(int arr[], int n) -{ - set < int > active; // The current built LIS. - active.insert(arr[0]); - // Loop through every element. - for (int i = 1; i < n; ++i) - { - auto get = active.lower_bound(arr[i]); - if (get == active.end()) - { - active.insert(arr[i]); - } // current element is the greatest so LIS increases by 1. - else - { - int val = * get; // we find the position where arr[i] will be in the LIS. If it is in the LIS already we do nothing - if (val > arr[i]) - { - // else we remove the bigger element and add a smaller element (which is arr[i]) and continue; - active.erase(get); - active.insert(arr[i]); - } - } - } - return active.size(); // size of the LIS. -} -int main(int argc, char const * argv[]) -{ - int n; - cout << "Enter size of array: "; - cin >> n; - int a[n]; - cout << "Enter array elements: "; - for (int i = 0; i < n; ++i) - { - cin >> a[i]; - } - cout << LIS(a, n) << endl; - return 0; -} diff --git a/dynamic_programming/Longest Increasing Subsequence.cpp b/dynamic_programming/Longest Increasing Subsequence.cpp deleted file mode 100644 index 49c54a941..000000000 --- a/dynamic_programming/Longest Increasing Subsequence.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//Program to calculate length of longest increasing subsequence in an array -#include -using namespace std; -int LIS(int a[], int n) -{ - int lis[n]; - for (int i = 0; i < n; ++i) - { - lis[i] = 1; - } - for (int i = 0; i < n; ++i) - { - for (int j = 0; j < i; ++j) - { - if (a[i] > a[j] && lis[i] < lis[j] + 1) - lis[i] = lis[j] + 1; - } - } - int res = 0; - for (int i = 0; i < n; ++i) - { - res = max(res, lis[i]); - } - return res; -} -int main(int argc, char const *argv[]) -{ - int n; - cout << "Enter size of array: "; - cin >> n; - int a[n]; - cout << "Enter array elements: "; - for (int i = 0; i < n; ++i) - { - cin >> a[i]; - } - cout << LIS(a, n) << endl; - return 0; -} \ No newline at end of file diff --git a/dynamic_programming/Matrix-Chain-Multiplication.cpp b/dynamic_programming/Matrix-Chain-Multiplication.cpp deleted file mode 100644 index 1e885bd7e..000000000 --- a/dynamic_programming/Matrix-Chain-Multiplication.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -using namespace std; - -#define MAX 10 - -// dp table to store the solution for already computed sub problems -int dp[MAX][MAX]; - -// Function to find the most efficient way to multiply the given sequence of matrices -int MatrixChainMultiplication(int dim[], int i, int j) -{ - // base case: one matrix - if (j <= i + 1) - return 0; - - // stores minimum number of scalar multiplications (i.e., cost) - // needed to compute the matrix M[i+1]...M[j] = M[i..j] - int min = INT_MAX; - - // if dp[i][j] is not calculated (calculate it!!) - - if (dp[i][j] == 0) - { - // take the minimum over each possible position at which the - // sequence of matrices can be split - - for (int k = i + 1; k <= j - 1; k++) - { - // recur for M[i+1]..M[k] to get a i x k matrix - int cost = MatrixChainMultiplication(dim, i, k); - - // recur for M[k+1]..M[j] to get a k x j matrix - cost += MatrixChainMultiplication(dim, k, j); - - // cost to multiply two (i x k) and (k x j) matrix - cost += dim[i] * dim[k] * dim[j]; - - if (cost < min) - min = cost; // store the minimum cost - } - dp[i][j] = min; - } - - // return min cost to multiply M[j+1]..M[j] - return dp[i][j]; -} - -// main function -int main() -{ - // Matrix i has Dimensions dim[i-1] & dim[i] for i=1..n - // input is 10 x 30 matrix, 30 x 5 matrix, 5 x 60 matrix - int dim[] = {10, 30, 5, 60}; - int n = sizeof(dim) / sizeof(dim[0]); - - // Function Calling: MatrixChainMultiplications(dimensions_array, starting, ending); - - cout << "Minimum cost is " << MatrixChainMultiplication(dim, 0, n - 1) << "\n"; - - return 0; -} \ No newline at end of file diff --git a/dynamic_programming/armstrong_number.cpp b/dynamic_programming/armstrong_number.cpp index 4dba89a27..270a705f7 100644 --- a/dynamic_programming/armstrong_number.cpp +++ b/dynamic_programming/armstrong_number.cpp @@ -1,21 +1,21 @@ // Program to check whether a number is an armstrong number or not #include -using std::cout; using std::cin; +using std::cout; int main() { - int n, k, d, s = 0; - cout << "Enter a number:"; - cin >> n; - k = n; - while (k != 0) { - d = k % 10; - s += d * d * d; - k /= 10; - } - if (s == n) - cout << n << "is an armstrong number"; - else - cout << n << "is not an armstrong number"; + int n, k, d, s = 0; + cout << "Enter a number:"; + cin >> n; + k = n; + while (k != 0) { + d = k % 10; + s += d * d * d; + k /= 10; + } + if (s == n) + cout << n << "is an armstrong number"; + else + cout << n << "is not an armstrong number"; } diff --git a/dynamic_programming/bellman_ford.cpp b/dynamic_programming/bellman_ford.cpp new file mode 100644 index 000000000..c96f3fd8e --- /dev/null +++ b/dynamic_programming/bellman_ford.cpp @@ -0,0 +1,116 @@ +#include +#include + +using namespace std; + +// Wrapper class for storing an edge +class Edge { + public: + int src, dst, weight; +}; + +// Wrapper class for storing a graph +class Graph { + public: + int vertexNum, edgeNum; + Edge *edges; + + // Constructs a graph with V vertices and E edges + Graph(int V, int E) { + this->vertexNum = V; + this->edgeNum = E; + this->edges = (Edge *)malloc(E * sizeof(Edge)); + } + + // Adds the given edge to the graph + void addEdge(int src, int dst, int weight) { + static int edgeInd = 0; + if (edgeInd < this->edgeNum) { + Edge newEdge; + newEdge.src = src; + newEdge.dst = dst; + newEdge.weight = weight; + this->edges[edgeInd++] = newEdge; + } + } +}; + +// Utility function to print distances +void print(int dist[], int V) { + cout << "\nVertex Distance" << endl; + for (int i = 0; i < V; i++) { + if (dist[i] != INT_MAX) + cout << i << "\t" << dist[i] << endl; + else + cout << i << "\tINF" << endl; + } +} + +// The main function that finds the shortest path from given source +// to all other vertices using Bellman-Ford.It also detects negative +// weight cycle +void BellmanFord(Graph graph, int src) { + int V = graph.vertexNum; + int E = graph.edgeNum; + int dist[V]; + + // Initialize distances array as INF for all except source + // Intialize source as zero + for (int i = 0; i < V; i++) dist[i] = INT_MAX; + dist[src] = 0; + + // Calculate shortest path distance from source to all edges + // A path can contain maximum (|V|-1) edges + for (int i = 0; i <= V - 1; i++) + for (int j = 0; j < E; j++) { + int u = graph.edges[j].src; + int v = graph.edges[j].dst; + int w = graph.edges[j].weight; + + if (dist[u] != INT_MAX && dist[u] + w < dist[v]) + dist[v] = dist[u] + w; + } + + // Iterate inner loop once more to check for negative cycle + for (int j = 0; j < E; j++) { + int u = graph.edges[j].src; + int v = graph.edges[j].dst; + int w = graph.edges[j].weight; + + if (dist[u] != INT_MAX && dist[u] + w < dist[v]) { + cout << "Graph contains negative weight cycle. Hence, shortest " + "distance not guaranteed." + << endl; + return; + } + } + + print(dist, V); + + return; +} + +// Driver Function +int main() { + int V, E, gsrc; + int src, dst, weight; + cout << "Enter number of vertices: "; + cin >> V; + cout << "Enter number of edges: "; + cin >> E; + Graph G(V, E); + for (int i = 0; i < E; i++) { + cout << "\nEdge " << i + 1 << "\nEnter source: "; + cin >> src; + cout << "Enter destination: "; + cin >> dst; + cout << "Enter weight: "; + cin >> weight; + G.addEdge(src, dst, weight); + } + cout << "\nEnter source: "; + cin >> gsrc; + BellmanFord(G, gsrc); + + return 0; +} diff --git a/dynamic_programming/Catalan-Numbers.cpp b/dynamic_programming/catalan_numbers.cpp similarity index 85% rename from dynamic_programming/Catalan-Numbers.cpp rename to dynamic_programming/catalan_numbers.cpp index 4d73cd51a..f5edaa916 100644 --- a/dynamic_programming/Catalan-Numbers.cpp +++ b/dynamic_programming/catalan_numbers.cpp @@ -9,10 +9,9 @@ #include using namespace std; -int *cat; // global array to hold catalan numbers +int *cat; // global array to hold catalan numbers -unsigned long int catalan_dp(int n) -{ +unsigned long int catalan_dp(int n) { /** Using the tabulation technique in dynamic programming, this function computes the first `n+1` Catalan numbers @@ -29,19 +28,17 @@ unsigned long int catalan_dp(int n) cat[0] = cat[1] = 1; // Compute the remaining numbers from index 2 to index n, using tabulation - for (int i = 2; i <= n; i++) - { + for (int i = 2; i <= n; i++) { cat[i] = 0; for (int j = 0; j < i; j++) - cat[i] += cat[j] * cat[i - j - 1]; // applying the definition here + cat[i] += cat[j] * cat[i - j - 1]; // applying the definition here } // Return the result return cat[n]; } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { int n; cout << "Enter n: "; cin >> n; @@ -49,8 +46,7 @@ int main(int argc, char *argv[]) cat = new int[n + 1]; cout << "Catalan numbers from 0 to " << n << " are:\n"; - for (int i = 0; i <= n; i++) - { + for (int i = 0; i <= n; i++) { cout << "catalan (" << i << ") = " << catalan_dp(i) << endl; // NOTE: Since `cat` is a global array, calling `catalan_dp` // repeatedly will not recompute the the values already computed diff --git a/dynamic_programming/coin_change.cpp b/dynamic_programming/coin_change.cpp new file mode 100644 index 000000000..8c8fc3dfb --- /dev/null +++ b/dynamic_programming/coin_change.cpp @@ -0,0 +1,48 @@ +#include +#include +using namespace std; + +// Function to find the Minimum number of coins required to get Sum S +int findMinCoins(int arr[], int n, int N) { + // dp[i] = no of coins required to get a total of i + int dp[N + 1]; + + // 0 coins are needed for 0 sum + + dp[0] = 0; + + for (int i = 1; i <= N; i++) { + // initialize minimum number of coins needed to infinity + dp[i] = INT_MAX; + int res = INT_MAX; + + // do for each coin + for (int c = 0; c < n; c++) { + if (i - arr[c] >= + 0) // check if coins doesn't become negative by including it + res = dp[i - arr[c]]; + + // if total can be reached by including current coin c, + // update minimum number of coins needed dp[i] + if (res != INT_MAX) + dp[i] = min(dp[i], res + 1); + } + } + + // The Minimum No of Coins Required for N = dp[N] + return dp[N]; +} + +int main() { + // No of Coins We Have + int arr[] = {1, 2, 3, 4}; + int n = sizeof(arr) / sizeof(arr[0]); + + // Total Change Required + int N = 15; + + cout << "Minimum Number of Coins Required " << findMinCoins(arr, n, N) + << "\n"; + + return 0; +} \ No newline at end of file diff --git a/dynamic_programming/cut_rod.cpp b/dynamic_programming/cut_rod.cpp new file mode 100644 index 000000000..136c78dbb --- /dev/null +++ b/dynamic_programming/cut_rod.cpp @@ -0,0 +1,25 @@ +/*Given a rod of length n inches and an array of prices that +contains prices of all pieces of size smaller than n. Determine +the maximum value obtainable by cutting up the rod and selling +the pieces.*/ + +#include +using namespace std; +int cutrod(int p[], int n) { + int r[n + 1]; + r[0] = 0; + for (int j = 0; j < n; j++) { + int q = INT_MIN; + for (int i = 0; i <= j; i++) { + q = max(q, p[i] + r[j - i]); + } + r[j + 1] = q; + } + return r[n]; +} +int main() { + int price[] = {1, 5, 8, 9, 10, 17, 17, 20, 24, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}; + cout << cutrod(price, 30); + return 0; +} diff --git a/dynamic_programming/Edit Distance.cpp b/dynamic_programming/edit_distance.cpp similarity index 60% rename from dynamic_programming/Edit Distance.cpp rename to dynamic_programming/edit_distance.cpp index 996d3272c..889b080cb 100644 --- a/dynamic_programming/Edit Distance.cpp +++ b/dynamic_programming/edit_distance.cpp @@ -7,7 +7,7 @@ * a. Insert * b. Remove * c. Replace - * All of the above operations are + * All of the above operations are * of equal cost */ @@ -15,31 +15,27 @@ #include using namespace std; -int min(int x, int y, int z) -{ - return min(min(x, y), z); -} +int min(int x, int y, int z) { return min(min(x, y), z); } /* A Naive recursive C++ program to find * minimum number of operations to convert * str1 to str2. * O(3^m) */ -int editDist(string str1, string str2, int m, int n) -{ +int editDist(string str1, string str2, int m, int n) { if (m == 0) return n; if (n == 0) return m; - //If last characters are same then continue - //for the rest of them. + // If last characters are same then continue + // for the rest of them. if (str1[m - 1] == str2[n - 1]) return editDist(str1, str2, m - 1, n - 1); - //If last not same, then 3 possibilities - //a.Insert b.Remove c. Replace - //Get min of three and continue for rest. + // If last not same, then 3 possibilities + // a.Insert b.Remove c. Replace + // Get min of three and continue for rest. return 1 + min(editDist(str1, str2, m, n - 1), editDist(str1, str2, m - 1, n), editDist(str1, str2, m - 1, n - 1)); @@ -48,33 +44,29 @@ int editDist(string str1, string str2, int m, int n) /* A DP based program * O(m x n) */ -int editDistDP(string str1, string str2, int m, int n) -{ - - //Create Table for SubProblems +int editDistDP(string str1, string str2, int m, int n) { + // Create Table for SubProblems int dp[m + 1][n + 1]; - //Fill d[][] in bottom up manner - for (int i = 0; i <= m; i++) - { - for (int j = 0; j <= n; j++) - { - //If str1 empty. Then add all of str2 + // Fill d[][] in bottom up manner + for (int i = 0; i <= m; i++) { + for (int j = 0; j <= n; j++) { + // If str1 empty. Then add all of str2 if (i == 0) dp[i][j] = j; - //If str2 empty. Then add all of str1 + // If str2 empty. Then add all of str1 else if (j == 0) dp[i][j] = i; - //If character same. Recur for remaining + // If character same. Recur for remaining else if (str1[i - 1] == str2[j - 1]) dp[i][j] = dp[i - 1][j - 1]; else - dp[i][j] = 1 + min(dp[i][j - 1], //Insert - dp[i - 1][j], //Remove - dp[i - 1][j - 1] //Replace + dp[i][j] = 1 + min(dp[i][j - 1], // Insert + dp[i - 1][j], // Remove + dp[i - 1][j - 1] // Replace ); } } @@ -82,8 +74,7 @@ int editDistDP(string str1, string str2, int m, int n) return dp[m][n]; } -int main() -{ +int main() { string str1 = "sunday"; string str2 = "saturday"; diff --git a/dynamic_programming/Egg-Dropping-Puzzle.cpp b/dynamic_programming/egg_dropping_puzzle.cpp similarity index 63% rename from dynamic_programming/Egg-Dropping-Puzzle.cpp rename to dynamic_programming/egg_dropping_puzzle.cpp index a441f29cb..7a769ea47 100644 --- a/dynamic_programming/Egg-Dropping-Puzzle.cpp +++ b/dynamic_programming/egg_dropping_puzzle.cpp @@ -1,35 +1,29 @@ -/* Function to get minimun number of trials needed - * in worst case with n eggs and k floors +/* Function to get minimun number of trials needed + * in worst case with n eggs and k floors */ -#include #include +#include using namespace std; -int eggDrop(int n, int k) -{ +int eggDrop(int n, int k) { int eggFloor[n + 1][k + 1]; int result; - for (int i = 1; i <= n; i++) - { - eggFloor[i][1] = 1; //n eggs..1 Floor - eggFloor[i][0] = 0; //n eggs..0 Floor + for (int i = 1; i <= n; i++) { + eggFloor[i][1] = 1; // n eggs..1 Floor + eggFloor[i][0] = 0; // n eggs..0 Floor } // Only one egg available - for (int j = 1; j <= k; j++) - { + for (int j = 1; j <= k; j++) { eggFloor[1][j] = j; } - for (int i = 2; i <= n; i++) - { - for (int j = 2; j <= k; j++) - { + for (int i = 2; i <= n; i++) { + for (int j = 2; j <= k; j++) { eggFloor[i][j] = INT_MAX; - for (int x = 1; x <= j; x++) - { + for (int x = 1; x <= j; x++) { // 1+max(eggBreak[one less egg, lower floors], // eggDoesntBreak[same # of eggs, upper floors]); result = 1 + max(eggFloor[i - 1][x - 1], eggFloor[i][j - x]); @@ -42,8 +36,7 @@ int eggDrop(int n, int k) return eggFloor[n][k]; } -int main() -{ +int main() { int n, k; cout << "Enter number of eggs and floors: "; cin >> n >> k; diff --git a/dynamic_programming/fibonacci_bottom_up.cpp b/dynamic_programming/fibonacci_bottom_up.cpp new file mode 100644 index 000000000..555f15282 --- /dev/null +++ b/dynamic_programming/fibonacci_bottom_up.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +int fib(int n) { + int res[3]; + res[0] = 0; + res[1] = 1; + for (int i = 2; i <= n; i++) { + res[2] = res[1] + res[0]; + res[0] = res[1]; + res[1] = res[2]; + } + return res[1]; +} +int main(int argc, char const *argv[]) { + int n; + cout << "Enter n: "; + cin >> n; + cout << "Fibonacci number is "; + cout << fib(n) << endl; + return 0; +} diff --git a/dynamic_programming/fibonacci_top_down.cpp b/dynamic_programming/fibonacci_top_down.cpp new file mode 100644 index 000000000..3c0c9a1a3 --- /dev/null +++ b/dynamic_programming/fibonacci_top_down.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +int arr[1000000]; +int fib(int n) { + if (arr[n] == -1) { + if (n <= 1) + arr[n] = n; + else + arr[n] = fib(n - 1) + fib(n - 2); + } + return arr[n]; +} +int main(int argc, char const *argv[]) { + int n; + cout << "Enter n: "; + cin >> n; + for (int i = 0; i < n + 1; ++i) { + arr[i] = -1; + } + cout << "Fibonacci number is " << fib(n) << endl; + return 0; +} \ No newline at end of file diff --git a/dynamic_programming/floyd_warshall.cpp b/dynamic_programming/floyd_warshall.cpp new file mode 100644 index 000000000..d193ebbd5 --- /dev/null +++ b/dynamic_programming/floyd_warshall.cpp @@ -0,0 +1,107 @@ +#include +#include +#include + +using std::cin; +using std::cout; +using std::endl; + +// Wrapper class for storing a graph +class Graph { + public: + int vertexNum; + int **edges; + + // Constructs a graph with V vertices and E edges + Graph(int V) { + this->vertexNum = V; + this->edges = new int *[V]; + for (int i = 0; i < V; i++) { + this->edges[i] = new int[V]; + for (int j = 0; j < V; j++) this->edges[i][j] = INT_MAX; + this->edges[i][i] = 0; + } + } + + ~Graph() { + for (int i = 0; i < vertexNum; i++) delete[] edges[i]; + delete[] edges; + } + + // Adds the given edge to the graph + void addEdge(int src, int dst, int weight) { + this->edges[src][dst] = weight; + } +}; + +// Utility function to print distances +void print(int dist[], int V) { + cout << "\nThe Distance matrix for Floyd - Warshall" << endl; + for (int i = 0; i < V; i++) { + for (int j = 0; j < V; j++) { + if (dist[i * V + j] != INT_MAX) + cout << dist[i * V + j] << "\t"; + else + cout << "INF" + << "\t"; + } + cout << endl; + } +} + +// The main function that finds the shortest path from a vertex +// to all other vertices using Floyd-Warshall Algorithm. +void FloydWarshall(Graph graph) { + int V = graph.vertexNum; + int dist[V][V]; + + // Initialise distance array + for (int i = 0; i < V; i++) + for (int j = 0; j < V; j++) dist[i][j] = graph.edges[i][j]; + + // Calculate distances + for (int k = 0; k < V; k++) + // Choose an intermediate vertex + + for (int i = 0; i < V; i++) + // Choose a source vertex for given intermediate + + for (int j = 0; j < V; j++) + // Choose a destination vertex for above source vertex + + if (dist[i][k] != INT_MAX && dist[k][j] != INT_MAX && + dist[i][k] + dist[k][j] < dist[i][j]) + // If the distance through intermediate vertex is less than + // direct edge then update value in distance array + dist[i][j] = dist[i][k] + dist[k][j]; + + // Convert 2d array to 1d array for print + int dist1d[V * V]; + for (int i = 0; i < V; i++) + for (int j = 0; j < V; j++) dist1d[i * V + j] = dist[i][j]; + + print(dist1d, V); +} + +// Driver Function +int main() { + int V, E; + int src, dst, weight; + cout << "Enter number of vertices: "; + cin >> V; + cout << "Enter number of edges: "; + cin >> E; + Graph G(V); + for (int i = 0; i < E; i++) { + cout << "\nEdge " << i + 1 << "\nEnter source: "; + cin >> src; + cout << "Enter destination: "; + cin >> dst; + cout << "Enter weight: "; + cin >> weight; + G.addEdge(src, dst, weight); + } + FloydWarshall(G); + + return 0; +} diff --git a/dynamic_programming/kadane.cpp b/dynamic_programming/kadane.cpp index bf2aa76ac..b5272756b 100644 --- a/dynamic_programming/kadane.cpp +++ b/dynamic_programming/kadane.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include int maxSubArraySum(int a[], int size) { int max_so_far = INT_MIN, max_ending_here = 0; @@ -15,7 +15,6 @@ int maxSubArraySum(int a[], int size) { return max_so_far; } - int main() { int n, i; std::cout << "Enter the number of elements \n"; diff --git a/dynamic_programming/longest_common_string.cpp b/dynamic_programming/longest_common_string.cpp index c1e89d6db..81fa8a002 100644 --- a/dynamic_programming/longest_common_string.cpp +++ b/dynamic_programming/longest_common_string.cpp @@ -1,65 +1,53 @@ #include using namespace std; -int max(int a,int b) -{ - return (a > b) ? a : b; -} +int max(int a, int b) { return (a > b) ? a : b; } -int main() -{ - char str1[]="DEFBCD"; - char str2[]="ABDEFJ"; - int i,j,k; - int n=strlen(str1)+1; - int m=strlen(str2)+1; - //cout<ma) - { - ma=a[i][j]; - indi=i; - indj=j; + for(j=0;j ma) { + ma = a[i][j]; + indi = i; + indj = j; } } } - cout< +using namespace std; + +void Print(int trace[20][20], int m, int n, string a) { + if (m == 0 || n == 0) { + return; + } + if (trace[m][n] == 1) { + Print(trace, m - 1, n - 1, a); + cout << a[m - 1]; + } else if (trace[m][n] == 2) { + Print(trace, m - 1, n, a); + } else if (trace[m][n] == 3) { + Print(trace, m, n - 1, a); + } +} + +int lcs(string a, string b) { + int m = a.length(), n = b.length(); + int res[m + 1][n + 1]; + int trace[20][20]; + + // fills up the arrays with zeros. + for (int i = 0; i < m + 1; i++) { + for (int j = 0; j < n + 1; j++) { + res[i][j] = 0; + trace[i][j] = 0; + } + } + + for (int i = 0; i < m + 1; ++i) { + for (int j = 0; j < n + 1; ++j) { + if (i == 0 || j == 0) { + res[i][j] = 0; + trace[i][j] = 0; + } + + else if (a[i - 1] == b[j - 1]) { + res[i][j] = 1 + res[i - 1][j - 1]; + trace[i][j] = 1; // 1 means trace the matrix in upper left + // diagonal direction. + } else { + if (res[i - 1][j] > res[i][j - 1]) { + res[i][j] = res[i - 1][j]; + trace[i][j] = + 2; // 2 means trace the matrix in upwards direction. + } else { + res[i][j] = res[i][j - 1]; + trace[i][j] = + 3; // means trace the matrix in left direction. + } + } + } + } + Print(trace, m, n, a); + return res[m][n]; +} + +int main() { + string a, b; + cin >> a >> b; + cout << lcs(a, b); + return 0; +} diff --git a/dynamic_programming/longest_increasing_subsequence.cpp b/dynamic_programming/longest_increasing_subsequence.cpp new file mode 100644 index 000000000..b6a798aa0 --- /dev/null +++ b/dynamic_programming/longest_increasing_subsequence.cpp @@ -0,0 +1,32 @@ +// Program to calculate length of longest increasing subsequence in an array +#include +using namespace std; +int LIS(int a[], int n) { + int lis[n]; + for (int i = 0; i < n; ++i) { + lis[i] = 1; + } + for (int i = 0; i < n; ++i) { + for (int j = 0; j < i; ++j) { + if (a[i] > a[j] && lis[i] < lis[j] + 1) + lis[i] = lis[j] + 1; + } + } + int res = 0; + for (int i = 0; i < n; ++i) { + res = max(res, lis[i]); + } + return res; +} +int main(int argc, char const *argv[]) { + int n; + cout << "Enter size of array: "; + cin >> n; + int a[n]; + cout << "Enter array elements: "; + for (int i = 0; i < n; ++i) { + cin >> a[i]; + } + cout << LIS(a, n) << endl; + return 0; +} \ No newline at end of file diff --git a/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp b/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp new file mode 100644 index 000000000..5bc72345c --- /dev/null +++ b/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp @@ -0,0 +1,41 @@ +// Program to calculate length of longest increasing subsequence in an array +// in O(n log n) +// tested on : https://cses.fi/problemset/task/1145/ + +#include + +using namespace std; +int LIS(int arr[], int n) { + set active; // The current built LIS. + active.insert(arr[0]); + // Loop through every element. + for (int i = 1; i < n; ++i) { + auto get = active.lower_bound(arr[i]); + if (get == active.end()) { + active.insert(arr[i]); + } // current element is the greatest so LIS increases by 1. + else { + int val = *get; // we find the position where arr[i] will be in the + // LIS. If it is in the LIS already we do nothing + if (val > arr[i]) { + // else we remove the bigger element and add a smaller element + // (which is arr[i]) and continue; + active.erase(get); + active.insert(arr[i]); + } + } + } + return active.size(); // size of the LIS. +} +int main(int argc, char const* argv[]) { + int n; + cout << "Enter size of array: "; + cin >> n; + int a[n]; + cout << "Enter array elements: "; + for (int i = 0; i < n; ++i) { + cin >> a[i]; + } + cout << LIS(a, n) << endl; + return 0; +} diff --git a/dynamic_programming/matrix_chain_multiplication.cpp b/dynamic_programming/matrix_chain_multiplication.cpp new file mode 100644 index 000000000..7d6647c52 --- /dev/null +++ b/dynamic_programming/matrix_chain_multiplication.cpp @@ -0,0 +1,61 @@ +#include +#include +using namespace std; + +#define MAX 10 + +// dp table to store the solution for already computed sub problems +int dp[MAX][MAX]; + +// Function to find the most efficient way to multiply the given sequence of +// matrices +int MatrixChainMultiplication(int dim[], int i, int j) { + // base case: one matrix + if (j <= i + 1) + return 0; + + // stores minimum number of scalar multiplications (i.e., cost) + // needed to compute the matrix M[i+1]...M[j] = M[i..j] + int min = INT_MAX; + + // if dp[i][j] is not calculated (calculate it!!) + + if (dp[i][j] == 0) { + // take the minimum over each possible position at which the + // sequence of matrices can be split + + for (int k = i + 1; k <= j - 1; k++) { + // recur for M[i+1]..M[k] to get a i x k matrix + int cost = MatrixChainMultiplication(dim, i, k); + + // recur for M[k+1]..M[j] to get a k x j matrix + cost += MatrixChainMultiplication(dim, k, j); + + // cost to multiply two (i x k) and (k x j) matrix + cost += dim[i] * dim[k] * dim[j]; + + if (cost < min) + min = cost; // store the minimum cost + } + dp[i][j] = min; + } + + // return min cost to multiply M[j+1]..M[j] + return dp[i][j]; +} + +// main function +int main() { + // Matrix i has Dimensions dim[i-1] & dim[i] for i=1..n + // input is 10 x 30 matrix, 30 x 5 matrix, 5 x 60 matrix + int dim[] = {10, 30, 5, 60}; + int n = sizeof(dim) / sizeof(dim[0]); + + // Function Calling: MatrixChainMultiplications(dimensions_array, starting, + // ending); + + cout << "Minimum cost is " << MatrixChainMultiplication(dim, 0, n - 1) + << "\n"; + + return 0; +} \ No newline at end of file diff --git a/dynamic_programming/searching_of_element_in_dynamic_array.cpp b/dynamic_programming/searching_of_element_in_dynamic_array.cpp index 9ee48dded..7792a5149 100644 --- a/dynamic_programming/searching_of_element_in_dynamic_array.cpp +++ b/dynamic_programming/searching_of_element_in_dynamic_array.cpp @@ -1,36 +1,36 @@ /* -*this program is use to find any elemet in any row with variable array size -*aplication of pointer is use in it -*important point start from here to: -*the index value of array can be go to 1 to 100000 -*check till array[1000] -*end here -*how to work example: -**Question: -***number of array 2 -***quarry 3 -***array 1 is {1 2 3 4 5} -***array 2 is {6 7} -****i) what is 2nd element in 1st array -****ii) what is 1st element in 2nd array -****iii) what is 5th element in 1st array -*****output: -*****Enter Number of array you want to Store : 2 -*****Enter Number of Question or Quary you want to do Related to Array : 3 -*****Enter number of element in 1 rows : 5 -*****Enter the element of Array 1 2 3 4 5 -*****Enter number of element in 2 rows : 2 -*****Enter the element of Array 6 7 -*****enter the number of row which element You want to find : 1 -*****enter the position of element which You want to find : 2 -*****The element is 2 -*****enter the number of row which element You want to find : 2 -*****enter the position of element which You want to find : 1 -*****The element is 6 -*****enter the number of row which element You want to find : 1 -*****enter the position of element which You want to find : 5 -*****The element is 5 -*/ + *this program is use to find any elemet in any row with variable array size + *aplication of pointer is use in it + *important point start from here to: + *the index value of array can be go to 1 to 100000 + *check till array[1000] + *end here + *how to work example: + **Question: + ***number of array 2 + ***quarry 3 + ***array 1 is {1 2 3 4 5} + ***array 2 is {6 7} + ****i) what is 2nd element in 1st array + ****ii) what is 1st element in 2nd array + ****iii) what is 5th element in 1st array + *****output: + *****Enter Number of array you want to Store : 2 + *****Enter Number of Question or Quary you want to do Related to Array : 3 + *****Enter number of element in 1 rows : 5 + *****Enter the element of Array 1 2 3 4 5 + *****Enter number of element in 2 rows : 2 + *****Enter the element of Array 6 7 + *****enter the number of row which element You want to find : 1 + *****enter the position of element which You want to find : 2 + *****The element is 2 + *****enter the number of row which element You want to find : 2 + *****enter the position of element which You want to find : 1 + *****The element is 6 + *****enter the number of row which element You want to find : 1 + *****enter the position of element which You want to find : 5 + *****The element is 5 + */ #include // this is main fuction @@ -46,7 +46,7 @@ int main() { // create a Array in run time because use can // change the size of each array which he/she is going to store // create a 2D array - int** ar = new int* [x](); + int** ar = new int*[x](); // this for loop is use for entering different variable size array // *** for (r = 0; r < x; r++) { @@ -75,6 +75,6 @@ int main() { std::cin >> q1; q1 = q1 - 1; // use this to find desire position of element in desire array - std::cout <<"The element is "<< ar[r1][q1] < -#include +#include +#include // global declarations // no of nodes max limit. @@ -37,7 +37,7 @@ void depth_first_search(int u) { depth_first_search(v); // select maximum sub-tree height from all children. - child_height = std::max(child_height, dp[v]+1); + child_height = std::max(child_height, dp[v] + 1); } } // assigned the max child height to current visited node. @@ -61,9 +61,9 @@ int main() { adj[v].push_back(u); } // initialize all nodes as unvisited. - visited.assign(number_of_nodes+1, false); + visited.assign(number_of_nodes + 1, false); // initialize depth of all nodes to 0. - dp.assign(number_of_nodes+1, 0); + dp.assign(number_of_nodes + 1, 0); // function call which will initialize the height of all nodes. depth_first_search(1); std::cout << "Height of the Tree : " << dp[1] << std::endl; diff --git a/graph/BFS.cpp b/graph/BFS.cpp deleted file mode 100644 index e4e12886b..000000000 --- a/graph/BFS.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -using namespace std; -class graph -{ - int v; - list *adj; - -public: - graph(int v); - void addedge(int src, int dest); - void printgraph(); - void bfs(int s); -}; -graph::graph(int v) -{ - this->v = v; - this->adj = new list[v]; -} -void graph::addedge(int src, int dest) -{ - src--; - dest--; - adj[src].push_back(dest); - //adj[dest].push_back(src); -} -void graph::printgraph() -{ - for (int i = 0; i < this->v; i++) - { - cout << "Adjacency list of vertex " << i + 1 << " is \n"; - list::iterator it; - for (it = adj[i].begin(); it != adj[i].end(); ++it) - { - cout << *it + 1 << " "; - } - cout << endl; - } -} -void graph::bfs(int s) -{ - bool *visited = new bool[this->v + 1]; - memset(visited, false, sizeof(bool) * (this->v + 1)); - visited[s] = true; - list q; - q.push_back(s); - list::iterator it; - while (!q.empty()) - { - int u = q.front(); - cout << u << " "; - q.pop_front(); - for (it = adj[u].begin(); it != adj[u].end(); ++it) - { - if (visited[*it] == false) - { - visited[*it] = true; - q.push_back(*it); - } - } - } -} -int main() -{ - graph g(4); - g.addedge(1, 2); - g.addedge(2, 3); - g.addedge(3, 4); - g.addedge(1, 4); - g.addedge(1, 3); - //g.printgraph(); - g.bfs(2); - return 0; -} diff --git a/graph/DFS.cpp b/graph/DFS.cpp deleted file mode 100644 index 656711ac8..000000000 --- a/graph/DFS.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int v = 4; -void DFSUtil_(int graph[4][4], bool visited[], int s) -{ - visited[s] = true; - cout << s << " "; - for (int i = 0; i < v; i++) - { - if (graph[s][i] == 1 && visited[i] == false) - { - DFSUtil_(graph, visited, i); - } - } -} - -void DFS_(int graph[4][4], int s) -{ - bool visited[v]; - memset(visited, 0, sizeof(visited)); - DFSUtil_(graph, visited, s); -} - -int main() -{ - int graph[4][4] = {{0, 1, 1, 0}, {0, 0, 1, 0}, {1, 0, 0, 1}, {0, 0, 0, 1}}; - cout << "DFS: "; - DFS_(graph, 2); - cout << endl; - return 0; -} \ No newline at end of file diff --git a/graph/Kruskal.cpp b/graph/Kruskal.cpp deleted file mode 100644 index 21b04ce49..000000000 --- a/graph/Kruskal.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include -//#include -//using namespace boost::multiprecision; -const int mx = 1e6 + 5; -const long int inf = 2e9; -typedef long long ll; -#define rep(i, n) for (i = 0; i < n; i++) -#define repp(i, a, b) for (i = a; i <= b; i++) -#define pii pair -#define vpii vector -#define vi vector -#define vll vector -#define r(x) scanf("%d", &x) -#define rs(s) scanf("%s", s) -#define gc getchar_unlocked -#define pc putchar_unlocked -#define mp make_pair -#define pb push_back -#define lb lower_bound -#define ub upper_bound -#define endl "\n" -#define fast \ - ios_base::sync_with_stdio(false); \ - cin.tie(NULL); \ - cout.tie(NULL); -using namespace std; -void in(int &x) -{ - register int c = gc(); - x = 0; - int neg = 0; - for (; ((c < 48 || c > 57) && c != '-'); c = gc()) - ; - if (c == '-') - { - neg = 1; - c = gc(); - } - for (; c > 47 && c < 58; c = gc()) - { - x = (x << 1) + (x << 3) + c - 48; - } - if (neg) - x = -x; -} -void out(int n) -{ - int N = n, rev, count = 0; - rev = N; - if (N == 0) - { - pc('0'); - return; - } - while ((rev % 10) == 0) - { - count++; - rev /= 10; - } - rev = 0; - while (N != 0) - { - rev = (rev << 3) + (rev << 1) + N % 10; - N /= 10; - } - while (rev != 0) - { - pc(rev % 10 + '0'); - rev /= 10; - } - while (count--) - pc('0'); -} -ll parent[mx], arr[mx], node, edge; -vector>> v; -void initial() -{ - int i; - rep(i, node + edge) - parent[i] = i; -} -int root(int i) -{ - while (parent[i] != i) - { - parent[i] = parent[parent[i]]; - i = parent[i]; - } - return i; -} -void join(int x, int y) -{ - int root_x = root(x); //Disjoint set union by rank - int root_y = root(y); - parent[root_x] = root_y; -} -ll kruskal() -{ - ll mincost = 0, i, x, y; - rep(i, edge) - { - x = v[i].second.first; - y = v[i].second.second; - if (root(x) != root(y)) - { - mincost += v[i].first; - join(x, y); - } - } - return mincost; -} -int main() -{ - fast; - while (1) - { - int i, j, from, to, cost, totalcost = 0; - cin >> node >> edge; //Enter the nodes and edges - if (node == 0 && edge == 0) - break; //Enter 0 0 to break out - initial(); //Initialise the parent array - rep(i, edge) - { - cin >> from >> to >> cost; - v.pb(mp(cost, mp(from, to))); - totalcost += cost; - } - sort(v.begin(), v.end()); - // rep(i,v.size()) - // cout< -#include -#include -using namespace std; - -int n, m; // For number of Vertices (V) and number of edges (E) -vector> G; -vector visited; -vector ans; - -void dfs(int v) -{ - visited[v] = true; - for (int u : G[v]) - { - if (!visited[u]) - dfs(u); - } - ans.push_back(v); -} - -void topological_sort() -{ - visited.assign(n, false); - ans.clear(); - for (int i = 0; i < n; ++i) - { - if (!visited[i]) - dfs(i); - } - reverse(ans.begin(), ans.end()); -} -int main() -{ - cout << "Enter the number of vertices and the number of directed edges\n"; - cin >> n >> m; - int x, y; - G.resize(n, vector()); - for (int i = 0; i < n; ++i) - { - cin >> x >> y; - x--, y--; // to convert 1-indexed to 0-indexed - G[x].push_back(y); - } - topological_sort(); - cout << "Topological Order : \n"; - for (int v : ans) - { - cout << v + 1 << ' '; // converting zero based indexing back to one based. - } - cout << '\n'; - return 0; -} diff --git a/graph/bfs.cpp b/graph/bfs.cpp new file mode 100644 index 000000000..3acee8f80 --- /dev/null +++ b/graph/bfs.cpp @@ -0,0 +1,62 @@ +#include +using namespace std; +class graph { + int v; + list *adj; + + public: + graph(int v); + void addedge(int src, int dest); + void printgraph(); + void bfs(int s); +}; +graph::graph(int v) { + this->v = v; + this->adj = new list[v]; +} +void graph::addedge(int src, int dest) { + src--; + dest--; + adj[src].push_back(dest); + // adj[dest].push_back(src); +} +void graph::printgraph() { + for (int i = 0; i < this->v; i++) { + cout << "Adjacency list of vertex " << i + 1 << " is \n"; + list::iterator it; + for (it = adj[i].begin(); it != adj[i].end(); ++it) { + cout << *it + 1 << " "; + } + cout << endl; + } +} +void graph::bfs(int s) { + bool *visited = new bool[this->v + 1]; + memset(visited, false, sizeof(bool) * (this->v + 1)); + visited[s] = true; + list q; + q.push_back(s); + list::iterator it; + while (!q.empty()) { + int u = q.front(); + cout << u << " "; + q.pop_front(); + for (it = adj[u].begin(); it != adj[u].end(); ++it) { + if (visited[*it] == false) { + visited[*it] = true; + q.push_back(*it); + } + } + } +} +int main() { + graph g(4); + g.addedge(1, 2); + g.addedge(2, 3); + g.addedge(3, 4); + g.addedge(1, 4); + g.addedge(1, 3); + // g.printgraph(); + g.bfs(2); + return 0; +} diff --git a/graph/bridge_finding_with_tarjan_algorithm.cpp b/graph/bridge_finding_with_tarjan_algorithm.cpp index ca124f512..eec176af5 100644 --- a/graph/bridge_finding_with_tarjan_algorithm.cpp +++ b/graph/bridge_finding_with_tarjan_algorithm.cpp @@ -4,27 +4,27 @@ * Last Modified Date: May 24, 2020 * */ -#include // for std::vector #include // for min & max -#include // for cout -using std::vector; +#include // for cout +#include // for std::vector using std::cout; using std::min; +using std::vector; class Solution { - vector < vector < int > > graph; - vectorin_time , out_time; + vector> graph; + vector in_time, out_time; int timer; - vector < vector < int > > bridge; - vectorvisited; - void dfs(int current_node , int parent) { + vector> bridge; + vector visited; + void dfs(int current_node, int parent) { visited.at(current_node) = true; in_time[current_node] = out_time[current_node] = timer++; - for ( auto&itr : graph[current_node] ) { + for (auto& itr : graph[current_node]) { if (itr == parent) { continue; } if (!visited[itr]) { - dfs(itr , current_node); + dfs(itr, current_node); if (out_time[itr] > in_time[current_node]) { bridge.push_back({itr, current_node}); } @@ -34,14 +34,14 @@ class Solution { } public: - vector > search_bridges(int n, - const vector>& connections) { + vector> search_bridges(int n, + const vector>& connections) { timer = 0; graph.resize(n); in_time.assign(n, 0); visited.assign(n, false); out_time.assign(n, 0); - for (auto&itr : connections) { + for (auto& itr : connections) { graph.at(itr[0]).push_back(itr[1]); graph.at(itr[1]).push_back(itr[0]); } @@ -52,7 +52,7 @@ class Solution { int main(void) { Solution s1; int number_of_node = 5; - vector< vector >node; + vector> node; node.push_back({0, 1}); node.push_back({1, 3}); node.push_back({1, 2}); @@ -66,13 +66,13 @@ int main(void) { * 3 4 * * In this graph there are 4 bridges [0,2] , [2,4] , [3,5] , [1,2] - * + * * I assumed that the graph is bi-directional and connected. * */ - vector< vector > bridges = s1.search_bridges(number_of_node , node); + vector> bridges = s1.search_bridges(number_of_node, node); cout << bridges.size() << " bridges found!\n"; - for (auto&itr : bridges) { + for (auto& itr : bridges) { cout << itr[0] << " --> " << itr[1] << '\n'; } return 0; diff --git a/graph/connected_components.cpp b/graph/connected_components.cpp index 9c22cc35e..0bfb8bbdb 100644 --- a/graph/connected_components.cpp +++ b/graph/connected_components.cpp @@ -8,48 +8,47 @@ class graph { vector> adj; int connected_components; void depth_first_search(); - void explore(int, vector&); + void explore(int, vector &); + public: - explicit graph(int n): adj(n, vector()) { - connected_components = 0; - } + explicit graph(int n) : adj(n, vector()) { connected_components = 0; } void addEdge(int, int); int getConnectedComponents() { - depth_first_search(); - return connected_components; + depth_first_search(); + return connected_components; } }; void graph::addEdge(int u, int v) { - adj[u-1].push_back(v-1); - adj[v-1].push_back(u-1); + adj[u - 1].push_back(v - 1); + adj[v - 1].push_back(u - 1); } void graph::depth_first_search() { - int n = adj.size(); - vector visited(n, false); + int n = adj.size(); + vector visited(n, false); - for (int i = 0 ; i < n ; i++) { - if (!visited[i]) { - explore(i, visited); - connected_components++; + for (int i = 0; i < n; i++) { + if (!visited[i]) { + explore(i, visited); + connected_components++; + } } - } } void graph::explore(int u, vector &visited) { - visited[u] = true; - for (auto v : adj[u]) { - if (!visited[v]) { - explore(v, visited); + visited[u] = true; + for (auto v : adj[u]) { + if (!visited[v]) { + explore(v, visited); + } } - } } int main() { - graph g(4); - g.addEdge(1, 2); - g.addEdge(3, 2); - std::cout << g.getConnectedComponents(); - return 0; + graph g(4); + g.addEdge(1, 2); + g.addEdge(3, 2); + std::cout << g.getConnectedComponents(); + return 0; } diff --git a/graph/connected_components_with_dsu.cpp b/graph/connected_components_with_dsu.cpp index 2c5c6dab5..aa03bef8f 100644 --- a/graph/connected_components_with_dsu.cpp +++ b/graph/connected_components_with_dsu.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include int N; // denotes number of nodes; std::vector parent; @@ -31,8 +31,7 @@ void union_sets(int a, int b) { // To join 2 components to belong to one int no_of_connected_components() { // To find total no of connected components std::set temp; // temp set to count number of connected components - for (int i = 1; i <= N; i++) - temp.insert(find_set(i)); + for (int i = 1; i <= N; i++) temp.insert(find_set(i)); return temp.size(); } diff --git a/graph/dfs.cpp b/graph/dfs.cpp new file mode 100644 index 000000000..2d38c8725 --- /dev/null +++ b/graph/dfs.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +int v = 4; +void DFSUtil_(int graph[4][4], bool visited[], int s) { + visited[s] = true; + cout << s << " "; + for (int i = 0; i < v; i++) { + if (graph[s][i] == 1 && visited[i] == false) { + DFSUtil_(graph, visited, i); + } + } +} + +void DFS_(int graph[4][4], int s) { + bool visited[v]; + memset(visited, 0, sizeof(visited)); + DFSUtil_(graph, visited, s); +} + +int main() { + int graph[4][4] = {{0, 1, 1, 0}, {0, 0, 1, 0}, {1, 0, 0, 1}, {0, 0, 0, 1}}; + cout << "DFS: "; + DFS_(graph, 2); + cout << endl; + return 0; +} \ No newline at end of file diff --git a/graph/DFS_with_stack.cc b/graph/dfs_with_stack.cpp similarity index 74% rename from graph/DFS_with_stack.cc rename to graph/dfs_with_stack.cpp index cc67c7509..193f3f291 100644 --- a/graph/DFS_with_stack.cc +++ b/graph/dfs_with_stack.cpp @@ -11,8 +11,7 @@ using namespace std; int checked[999] = {WHITE}; -void dfs(const list lista[], int start) -{ +void dfs(const list lista[], int start) { stack stack; int checked[999] = {WHITE}; @@ -20,33 +19,28 @@ void dfs(const list lista[], int start) stack.push(start); checked[start] = GREY; - while (!stack.empty()) - { + while (!stack.empty()) { int act = stack.top(); stack.pop(); - if (checked[act] == GREY) - { + if (checked[act] == GREY) { cout << act << ' '; - for (auto it = lista[act].begin(); it != lista[act].end(); ++it) - { + for (auto it = lista[act].begin(); it != lista[act].end(); ++it) { stack.push(*it); if (checked[*it] != BLACK) checked[*it] = GREY; } - checked[act] = BLACK; //nodo controllato + checked[act] = BLACK; // nodo controllato } } } -int main() -{ +int main() { int u, w; int n; cin >> n; list lista[INF]; - for (int i = 0; i < n; ++i) - { + for (int i = 0; i < n; ++i) { cin >> u >> w; lista[u].push_back(w); } diff --git a/graph/Dijkstra.cpp b/graph/dijkstra.cpp similarity index 67% rename from graph/Dijkstra.cpp rename to graph/dijkstra.cpp index b3ee44c41..650f0cd51 100644 --- a/graph/Dijkstra.cpp +++ b/graph/dijkstra.cpp @@ -1,49 +1,46 @@ -#include -#include #include #include +#include +#include using namespace std; #define INF 10000010 vector> graph[5 * 100001]; int dis[5 * 100001]; -int dij(vector> *v, int s, int *dis) -{ - priority_queue, vector>, greater>> pq; +int dij(vector> *v, int s, int *dis) { + priority_queue, vector>, + greater>> + pq; // source distance to zero. pq.push(make_pair(0, s)); dis[s] = 0; int u; - while (!pq.empty()) - { + while (!pq.empty()) { u = (pq.top()).second; pq.pop(); - for (vector>::iterator it = v[u].begin(); it != v[u].end(); it++) - { - if (dis[u] + it->first < dis[it->second]) - { + for (vector>::iterator it = v[u].begin(); + it != v[u].end(); it++) { + if (dis[u] + it->first < dis[it->second]) { dis[it->second] = dis[u] + it->first; pq.push(make_pair(dis[it->second], it->second)); } } } } -int main() -{ +int main() { int m, n, l, x, y, s; // n--> number of nodes , m --> number of edges cin >> n >> m; - for (int i = 0; i < m; i++) - { + for (int i = 0; i < m; i++) { // input edges. scanf("%d%d%d", &x, &y, &l); graph[x].push_back(make_pair(l, y)); - graph[y].push_back(make_pair(l, x)); // comment this line for directed graph + graph[y].push_back( + make_pair(l, x)); // comment this line for directed graph } // start node. scanf("%d", &s); // intialise all distances to infinity. - for (int i = 1; i <= n; i++) - dis[i] = INF; + for (int i = 1; i <= n; i++) dis[i] = INF; dij(graph, s, dis); for (int i = 1; i <= n; i++) diff --git a/graph/kosaraju.cpp b/graph/kosaraju.cpp index 2e66f131f..00c9d7ca0 100644 --- a/graph/kosaraju.cpp +++ b/graph/kosaraju.cpp @@ -1,134 +1,121 @@ -/* Implementation of Kosaraju's Algorithm to find out the strongly connected components (SCCs) in a graph. - Author:Anirban166 -*/ +/* Implementation of Kosaraju's Algorithm to find out the strongly connected + components (SCCs) in a graph. Author:Anirban166 +*/ -#include -#include +#include +#include using namespace std; /** -* Iterative function/method to print graph: -* @param a[] : array of vectors (2D) -* @param V : vertices -* @return void -**/ -void print(vector a[],int V) -{ - for(int i=0;i"; - for(int j=0;j a[], int V) { + for (int i = 0; i < V; i++) { + if (!a[i].empty()) + cout << "i=" << i << "-->"; + for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << " "; + if (!a[i].empty()) + cout << endl; } } /** -* //Recursive function/method to push vertices into stack passed as parameter: -* @param v : vertices -* @param &st : stack passed by reference -* @param vis[] : array to keep track of visited nodes (boolean type) -* @param adj[] : array of vectors to represent graph -* @return void -**/ -void push_vertex(int v,stack &st,bool vis[],vector adj[]) -{ - vis[v]=true; - for(auto i=adj[v].begin();i!=adj[v].end();i++) - { - if(vis[*i]==false) - push_vertex(*i,st,vis,adj); + * //Recursive function/method to push vertices into stack passed as parameter: + * @param v : vertices + * @param &st : stack passed by reference + * @param vis[] : array to keep track of visited nodes (boolean type) + * @param adj[] : array of vectors to represent graph + * @return void + **/ +void push_vertex(int v, stack &st, bool vis[], vector adj[]) { + vis[v] = true; + for (auto i = adj[v].begin(); i != adj[v].end(); i++) { + if (vis[*i] == false) + push_vertex(*i, st, vis, adj); } st.push(v); } - /** -* //Recursive function/method to implement depth first traversal(dfs): -* @param v : vertices -* @param vis[] : array to keep track of visited nodes (boolean type) -* @param grev[] : graph with reversed edges -* @return void -**/ -void dfs(int v,bool vis[],vector grev[]) -{ - vis[v]=true; + * //Recursive function/method to implement depth first traversal(dfs): + * @param v : vertices + * @param vis[] : array to keep track of visited nodes (boolean type) + * @param grev[] : graph with reversed edges + * @return void + **/ +void dfs(int v, bool vis[], vector grev[]) { + vis[v] = true; // cout<0)) - i.e. it returns the count of (number of) strongly connected components (SCCs) in the graph. (variable 'count_scc' within function) +* @return int ( 0, 1, 2..and so on, only unsigned values as either there can be +no SCCs i.e. none(0) or there will be x no. of SCCs (x>0)) i.e. it returns the +count of (number of) strongly connected components (SCCs) in the graph. +(variable 'count_scc' within function) **/ -int kosaraju(int V, vector adj[]) -{ - bool vis[V]={}; +int kosaraju(int V, vector adj[]) { + bool vis[V] = {}; stack st; - for(int v=0;v grev[V]; - for(int i=0;i 57) && c != '-'); c = gc()) + ; + if (c == '-') { + neg = 1; + c = gc(); + } + for (; c > 47 && c < 58; c = gc()) { + x = (x << 1) + (x << 3) + c - 48; + } + if (neg) + x = -x; +} +void out(int n) { + int N = n, rev, count = 0; + rev = N; + if (N == 0) { + pc('0'); + return; + } + while ((rev % 10) == 0) { + count++; + rev /= 10; + } + rev = 0; + while (N != 0) { + rev = (rev << 3) + (rev << 1) + N % 10; + N /= 10; + } + while (rev != 0) { + pc(rev % 10 + '0'); + rev /= 10; + } + while (count--) pc('0'); +} +ll parent[mx], arr[mx], node, edge; +vector>> v; +void initial() { + int i; + rep(i, node + edge) parent[i] = i; +} +int root(int i) { + while (parent[i] != i) { + parent[i] = parent[parent[i]]; + i = parent[i]; + } + return i; +} +void join(int x, int y) { + int root_x = root(x); // Disjoint set union by rank + int root_y = root(y); + parent[root_x] = root_y; +} +ll kruskal() { + ll mincost = 0, i, x, y; + rep(i, edge) { + x = v[i].second.first; + y = v[i].second.second; + if (root(x) != root(y)) { + mincost += v[i].first; + join(x, y); + } + } + return mincost; +} +int main() { + fast; + while (1) { + int i, j, from, to, cost, totalcost = 0; + cin >> node >> edge; // Enter the nodes and edges + if (node == 0 && edge == 0) + break; // Enter 0 0 to break out + initial(); // Initialise the parent array + rep(i, edge) { + cin >> from >> to >> cost; + v.pb(mp(cost, mp(from, to))); + totalcost += cost; + } + sort(v.begin(), v.end()); + // rep(i,v.size()) + // cout< adj[N]; // Graph - int up[LG][N]; // build this table - int level[N]; // get the levels of all of them + vector adj[N]; // Graph + int up[LG][N]; // build this table + int level[N]; // get the levels of all of them - lca(int n_): n(n_) - { + lca(int n_) : n(n_) { memset(up, -1, sizeof(up)); memset(level, 0, sizeof(level)); - for (int i = 0; i < n - 1; ++i) - { + for (int i = 0; i < n - 1; ++i) { int a, b; cin >> a >> b; a--; @@ -31,77 +28,59 @@ struct lca dfs(0, -1); build(); } - void verify() - { - for (int i = 0; i < n; ++i) - { + void verify() { + for (int i = 0; i < n; ++i) { cout << i << " : level: " << level[i] << endl; } cout << endl; - for (int i = 0; i < LG; ++i) - { + for (int i = 0; i < LG; ++i) { cout << "Power:" << i << ": "; - for (int j = 0; j < n; ++j) - { + for (int j = 0; j < n; ++j) { cout << up[i][j] << " "; } cout << endl; } } - void build() - { - for (int i = 1; i < LG; ++i) - { - for (int j = 0; j < n; ++j) - { - if (up[i - 1][j] != -1) - { + void build() { + for (int i = 1; i < LG; ++i) { + for (int j = 0; j < n; ++j) { + if (up[i - 1][j] != -1) { up[i][j] = up[i - 1][up[i - 1][j]]; } } } } - void dfs(int node, int par) - { + void dfs(int node, int par) { up[0][node] = par; - for (auto i: adj[node]) - { - if (i != par) - { + for (auto i : adj[node]) { + if (i != par) { level[i] = level[node] + 1; dfs(i, node); } } } - int query(int u, int v) - { + int query(int u, int v) { u--; v--; - if (level[v] > level[u]) - { + if (level[v] > level[u]) { swap(u, v); } // u is at the bottom. int dist = level[u] - level[v]; // Go up this much distance - for (int i = LG - 1; i >= 0; --i) - { - if (dist & (1 << i)) - { + for (int i = LG - 1; i >= 0; --i) { + if (dist & (1 << i)) { u = up[i][u]; } } - if (u == v) - { + if (u == v) { return u; } assert(level[u] == level[v]); - for (int i = LG - 1; i >= 0; --i) - { - if (up[i][u] != up[i][v]) - { + for (int i = LG - 1; i >= 0; --i) { + if (up[i][u] != up[i][v]) { u = up[i][u]; v = up[i][v]; } @@ -111,10 +90,9 @@ struct lca } }; -int main() -{ - int n; // number of nodes in the tree. - lca l(n); // will take the input in the format given +int main() { + int n; // number of nodes in the tree. + lca l(n); // will take the input in the format given // n-1 edges of the form // a b // Use verify function to see. diff --git a/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp b/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp new file mode 100644 index 000000000..cbd6bc15c --- /dev/null +++ b/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp @@ -0,0 +1,117 @@ +/* + * Author: Amit Kumar + * Created: May 24, 2020 + * Copyright: 2020, Open-Source + * Last Modified: May 25, 2020 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +// std::max capacity of node in graph +const int MAXN = 505; +class Graph { + int residual_capacity[MAXN][MAXN]; + int capacity[MAXN][MAXN]; // used while checking the flow of edge + int total_nodes; + int total_edges, source, sink; + int parent[MAXN]; + std::vector > edge_participated; + std::bitset visited; + int max_flow = 0; + bool bfs(int source, int sink) { // to find the augmented - path + memset(parent, -1, sizeof(parent)); + visited.reset(); + std::queue q; + q.push(source); + bool is_path_found = false; + while (q.empty() == false && is_path_found == false) { + int current_node = q.front(); + visited.set(current_node); + q.pop(); + for (int i = 0; i < total_nodes; ++i) { + if (residual_capacity[current_node][i] > 0 && !visited[i]) { + visited.set(i); + parent[i] = current_node; + if (i == sink) { + return true; + } + q.push(i); + } + } + } + return false; + } + + public: + Graph() { memset(residual_capacity, 0, sizeof(residual_capacity)); } + void set_graph(void) { + std::cin >> total_nodes >> total_edges >> source >> sink; + for (int start, destination, capacity_, i = 0; i < total_edges; ++i) { + std::cin >> start >> destination >> capacity_; + residual_capacity[start][destination] = capacity_; + capacity[start][destination] = capacity_; + } + } + void ford_fulkerson(void) { + while (bfs(source, sink)) { + int current_node = sink; + int flow = std::numeric_limits::max(); + while (current_node != source) { + int parent_ = parent[current_node]; + flow = std::min(flow, residual_capacity[parent_][current_node]); + current_node = parent_; + } + current_node = sink; + max_flow += flow; + while (current_node != source) { + int parent_ = parent[current_node]; + residual_capacity[parent_][current_node] -= flow; + residual_capacity[current_node][parent_] += flow; + current_node = parent_; + } + } + } + void print_flow_info(void) { + for (int i = 0; i < total_nodes; ++i) { + for (int j = 0; j < total_nodes; ++j) { + if (capacity[i][j] && + residual_capacity[i][j] < capacity[i][j]) { + edge_participated.push_back(std::make_tuple( + i, j, capacity[i][j] - residual_capacity[i][j])); + } + } + } + std::cout << "\nNodes : " << total_nodes << "\nMax flow: " << max_flow + << "\nEdge present in flow: " << edge_participated.size() + << '\n'; + std::cout << "\nSource\tDestination\tCapacity\total_nodes"; + for (auto& edge_data : edge_participated) { + int source, destination, capacity_; + std::tie(source, destination, capacity_) = edge_data; + std::cout << source << "\t" << destination << "\t\t" << capacity_ + << '\t'; + } + } +}; +int main(void) { + /* + Input Graph: (for testing ) + 4 5 0 3 + 0 1 10 + 1 2 1 + 1 3 1 + 0 2 1 + 2 3 10 + */ + Graph graph; + graph.set_graph(); + graph.ford_fulkerson(); + graph.print_flow_info(); + return 0; +} diff --git a/graph/prim.cpp b/graph/prim.cpp index 2923b5b25..5cc70bd39 100644 --- a/graph/prim.cpp +++ b/graph/prim.cpp @@ -1,22 +1,22 @@ // C++ program to implement Prim's Algorithm #include -#include #include +#include const int MAX = 1e4 + 5; -typedef std:: pair PII; +typedef std::pair PII; bool marked[MAX]; -std:: vector adj[MAX]; +std::vector adj[MAX]; int prim(int x) { // priority queue to maintain edges with respect to weights - std:: priority_queue, std:: greater > Q; + std::priority_queue, std::greater > Q; int y; int minimumCost = 0; PII p; - Q.push(std:: make_pair(0, x)); + Q.push(std::make_pair(0, x)); while (!Q.empty()) { // Select the edge with minimum weight p = Q.top(); @@ -40,19 +40,19 @@ int main() { int nodes, edges, x, y; int weight, minimumCost; - std:: cin >> nodes >> edges; // number of nodes & edges in graph + std::cin >> nodes >> edges; // number of nodes & edges in graph if (nodes == 0 || edges == 0) return 0; // Edges with their nodes & weight for (int i = 0; i < edges; ++i) { std::cin >> x >> y >> weight; - adj[x].push_back(std:: make_pair(weight, y)); - adj[y].push_back(std:: make_pair(weight, x)); + adj[x].push_back(std::make_pair(weight, y)); + adj[y].push_back(std::make_pair(weight, x)); } // Selecting 1 as the starting node minimumCost = prim(1); - std:: cout << minimumCost << std:: endl; + std::cout << minimumCost << std::endl; return 0; } diff --git a/graph/topological_sort.cpp b/graph/topological_sort.cpp new file mode 100644 index 000000000..9e6c8917b --- /dev/null +++ b/graph/topological_sort.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +using namespace std; + +int n, m; // For number of Vertices (V) and number of edges (E) +vector> G; +vector visited; +vector ans; + +void dfs(int v) { + visited[v] = true; + for (int u : G[v]) { + if (!visited[u]) + dfs(u); + } + ans.push_back(v); +} + +void topological_sort() { + visited.assign(n, false); + ans.clear(); + for (int i = 0; i < n; ++i) { + if (!visited[i]) + dfs(i); + } + reverse(ans.begin(), ans.end()); +} +int main() { + cout << "Enter the number of vertices and the number of directed edges\n"; + cin >> n >> m; + int x, y; + G.resize(n, vector()); + for (int i = 0; i < n; ++i) { + cin >> x >> y; + x--, y--; // to convert 1-indexed to 0-indexed + G[x].push_back(y); + } + topological_sort(); + cout << "Topological Order : \n"; + for (int v : ans) { + cout << v + 1 + << ' '; // converting zero based indexing back to one based. + } + cout << '\n'; + return 0; +} diff --git a/graph/topological_sort_by_kahns_algo.cpp b/graph/topological_sort_by_kahns_algo.cpp index eda2a74bc..57ee01b23 100644 --- a/graph/topological_sort_by_kahns_algo.cpp +++ b/graph/topological_sort_by_kahns_algo.cpp @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include int *topoSortKahn(int N, std::vector adj[]); @@ -13,7 +13,7 @@ int main() { return 0; int u, v; - std::vectorgraph[nodes]; + std::vector graph[nodes]; // create graph // example // 6 6 @@ -31,23 +31,23 @@ int main() { } } -int* topoSortKahn(int V, std::vector adj[]) { - std::vectorvis(V+1, false); - std::vectordeg(V+1, 0); +int *topoSortKahn(int V, std::vector adj[]) { + std::vector vis(V + 1, false); + std::vector deg(V + 1, 0); for (int i = 0; i < V; i++) { for (int j = 0; j < adj[i].size(); j++) { deg[adj[i][j]]++; } } - std::queueq; + std::queue q; for (int i = 0; i < V; i++) { if (deg[i] == 0) { q.push(i); vis[i] = true; } } - int *arr = new int[V+1]; - memset(arr, 0, V+1); + int *arr = new int[V + 1]; + memset(arr, 0, V + 1); int count = 0; while (!q.empty()) { int cur = q.front(); diff --git a/greedy_algorithms/Knapsack.cpp b/greedy_algorithms/Knapsack.cpp deleted file mode 100644 index 2135bd1eb..000000000 --- a/greedy_algorithms/Knapsack.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -using namespace std; - -struct Item -{ - int weight; - int profit; -}; - -float profitPerUnit(Item x) -{ - return (float)x.profit / (float)x.weight; -} - -int partition(Item arr[], int low, int high) -{ - Item pivot = arr[high]; // pivot - int i = (low - 1); // Index of smaller element - - for (int j = low; j < high; j++) - { - // If current element is smaller than or - // equal to pivot - if (profitPerUnit(arr[j]) <= profitPerUnit(pivot)) - { - i++; // increment index of smaller element - Item temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - } - } - Item temp = arr[i + 1]; - arr[i + 1] = arr[high]; - arr[high] = temp; - return (i + 1); -} - -void quickSort(Item arr[], int low, int high) -{ - if (low < high) - { - - int p = partition(arr, low, high); - - quickSort(arr, low, p - 1); - quickSort(arr, p + 1, high); - } -} - -int main() -{ - cout << "\nEnter the capacity of the knapsack : "; - float capacity; - cin >> capacity; - cout << "\n Enter the number of Items : "; - int n; - cin >> n; - Item itemArray[n]; - for (int i = 0; i < n; i++) - { - cout << "\nEnter the weight and profit of item " << i + 1 << " : "; - cin >> itemArray[i].weight; - cin >> itemArray[i].profit; - } - - quickSort(itemArray, 0, n - 1); - - // show(itemArray, n); - - float maxProfit = 0; - int i = n; - while (capacity > 0 && --i >= 0) - { - if (capacity >= itemArray[i].weight) - { - maxProfit += itemArray[i].profit; - capacity -= itemArray[i].weight; - cout << "\n\t" << itemArray[i].weight << "\t" << itemArray[i].profit; - } - else - { - maxProfit += profitPerUnit(itemArray[i]) * capacity; - cout << "\n\t" << capacity << "\t" << profitPerUnit(itemArray[i]) * capacity; - capacity = 0; - break; - } - } - - cout << "\nMax Profit : " << maxProfit; - - return 0; -} diff --git a/greedy_algorithms/Kruskals Minimum Spanning Tree.cpp b/greedy_algorithms/Kruskals Minimum Spanning Tree.cpp deleted file mode 100644 index 951d4a88a..000000000 --- a/greedy_algorithms/Kruskals Minimum Spanning Tree.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -using namespace std; - -#define V 6 -#define INFINITY 99999 - -int graph[V][V] = { - {0, 4, 1, 4, INFINITY, INFINITY}, - {4, 0, 3, 8, 3, INFINITY}, - {1, 3, 0, INFINITY, 1, INFINITY}, - {4, 8, INFINITY, 0, 5, 7}, - {INFINITY, 3, 1, 5, 0, INFINITY}, - {INFINITY, INFINITY, INFINITY, 7, INFINITY, 0}}; - -void findMinimumEdge() -{ - for (int i = 0; i < V; i++) - { - int min = INFINITY; - int minIndex = 0; - for (int j = 0; j < V; j++) - { - if (graph[i][j] != 0 && graph[i][j] < min) - { - min = graph[i][j]; - minIndex = j; - } - } - cout << i << " - " << minIndex << "\t" << graph[i][minIndex] << "\n"; - } -} - -int main() -{ - findMinimumEdge(); - return 0; -} diff --git a/greedy_algorithms/Prims Minimum Spanning Tree.cpp b/greedy_algorithms/Prims Minimum Spanning Tree.cpp deleted file mode 100644 index 769ca64e4..000000000 --- a/greedy_algorithms/Prims Minimum Spanning Tree.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -using namespace std; - -#define V 4 -#define INFINITY 99999 - -int graph[V][V] = { - {0, 5, 1, 2}, - {5, 0, 3, 3}, - {1, 3, 0, 4}, - {2, 3, 4, 0}}; - -struct mst -{ - bool visited; - int key; - int near; -}; - -mst MST_Array[V]; - -void initilize() -{ - for (int i = 0; i < V; i++) - { - MST_Array[i].visited = false; - MST_Array[i].key = INFINITY; // considering INFINITY as inifinity - MST_Array[i].near = i; - } - - MST_Array[0].key = 0; -} - -void updateNear() -{ - for (int v = 0; v < V; v++) - { - int min = INFINITY; - int minIndex = 0; - for (int i = 0; i < V; i++) - { - if (MST_Array[i].key < min && MST_Array[i].visited == false && MST_Array[i].key != INFINITY) - { - min = MST_Array[i].key; - minIndex = i; - } - } - - MST_Array[minIndex].visited = true; - - for (int i = 0; i < V; i++) - { - if (graph[minIndex][i] != 0 && graph[minIndex][i] < INFINITY) - { - if (graph[minIndex][i] < MST_Array[i].key) - { - MST_Array[i].key = graph[minIndex][i]; - MST_Array[i].near = minIndex; - } - } - } - } -} - -void show() -{ - for (int i = 0; i < V; i++) - { - cout << i << " - " << MST_Array[i].near << "\t" << graph[i][MST_Array[i].near] << "\n"; - } -} - -int main() -{ - initilize(); - updateNear(); - show(); - return 0; -} diff --git a/greedy_algorithms/Dijkstra.cpp b/greedy_algorithms/dijkstra.cpp similarity index 53% rename from greedy_algorithms/Dijkstra.cpp rename to greedy_algorithms/dijkstra.cpp index 0c7fffc8c..e4450379c 100644 --- a/greedy_algorithms/Dijkstra.cpp +++ b/greedy_algorithms/dijkstra.cpp @@ -1,31 +1,25 @@ -#include #include +#include using namespace std; -//Wrapper class for storing a graph -class Graph -{ -public: +// Wrapper class for storing a graph +class Graph { + public: int vertexNum; int **edges; - //Constructs a graph with V vertices and E edges - Graph(const int V) - { - + // Constructs a graph with V vertices and E edges + Graph(const int V) { // initializes the array edges. this->edges = new int *[V]; - for (int i = 0; i < V; i++) - { + for (int i = 0; i < V; i++) { edges[i] = new int[V]; } // fills the array with zeros. - for (int i = 0; i < V; i++) - { - for (int j = 0; j < V; j++) - { + for (int i = 0; i < V; i++) { + for (int j = 0; j < V; j++) { edges[i][j] = 0; } } @@ -33,20 +27,16 @@ public: this->vertexNum = V; } - //Adds the given edge to the graph - void addEdge(int src, int dst, int weight) - { + // Adds the given edge to the graph + void addEdge(int src, int dst, int weight) { this->edges[src][dst] = weight; } }; -//Utility function to find minimum distance vertex in mdist -int minDistance(int mdist[], bool vset[], int V) -{ +// Utility function to find minimum distance vertex in mdist +int minDistance(int mdist[], bool vset[], int V) { int minVal = INT_MAX, minInd = 0; - for (int i = 0; i < V; i++) - { - if (!vset[i] && (mdist[i] < minVal)) - { + for (int i = 0; i < V; i++) { + if (!vset[i] && (mdist[i] < minVal)) { minVal = mdist[i]; minInd = i; } @@ -55,12 +45,10 @@ int minDistance(int mdist[], bool vset[], int V) return minInd; } -//Utility function to print distances -void print(int dist[], int V) -{ +// Utility function to print distances +void print(int dist[], int V) { cout << "\nVertex Distance" << endl; - for (int i = 0; i < V; i++) - { + for (int i = 0; i < V; i++) { if (dist[i] < INT_MAX) cout << i << "\t" << dist[i] << endl; else @@ -68,36 +56,32 @@ void print(int dist[], int V) } } -//The main function that finds the shortest path from given source -//to all other vertices using Dijkstra's Algorithm.It doesn't work on negative -//weights -void Dijkstra(Graph graph, int src) -{ +// The main function that finds the shortest path from given source +// to all other vertices using Dijkstra's Algorithm.It doesn't work on negative +// weights +void Dijkstra(Graph graph, int src) { int V = graph.vertexNum; - int mdist[V]; //Stores updated distances to vertex - bool vset[V]; // vset[i] is true if the vertex i included + int mdist[V]; // Stores updated distances to vertex + bool vset[V]; // vset[i] is true if the vertex i included // in the shortest path tree - //Initialise mdist and vset. Set distance of source as zero - for (int i = 0; i < V; i++) - { + // Initialise mdist and vset. Set distance of source as zero + for (int i = 0; i < V; i++) { mdist[i] = INT_MAX; vset[i] = false; } mdist[src] = 0; - //iterate to find shortest path - for (int count = 0; count < V - 1; count++) - { + // iterate to find shortest path + for (int count = 0; count < V - 1; count++) { int u = minDistance(mdist, vset, V); vset[u] = true; - for (int v = 0; v < V; v++) - { - if (!vset[v] && graph.edges[u][v] && mdist[u] + graph.edges[u][v] < mdist[v]) - { + for (int v = 0; v < V; v++) { + if (!vset[v] && graph.edges[u][v] && + mdist[u] + graph.edges[u][v] < mdist[v]) { mdist[v] = mdist[u] + graph.edges[u][v]; } } @@ -106,9 +90,8 @@ void Dijkstra(Graph graph, int src) print(mdist, V); } -//Driver Function -int main() -{ +// Driver Function +int main() { int V, E, gsrc; int src, dst, weight; cout << "Enter number of vertices: "; @@ -116,8 +99,7 @@ int main() cout << "Enter number of edges: "; cin >> E; Graph G(V); - for (int i = 0; i < E; i++) - { + for (int i = 0; i < E; i++) { cout << "\nEdge " << i + 1 << "\nEnter source: "; cin >> src; cout << "Enter destination: "; @@ -126,12 +108,9 @@ int main() cin >> weight; // makes sure source and destionation are in the proper bounds. - if (src >= 0 && src < V && dst >= 0 && dst < V) - { + if (src >= 0 && src < V && dst >= 0 && dst < V) { G.addEdge(src, dst, weight); - } - else - { + } else { cout << "source and/or destination out of bounds" << endl; i--; continue; diff --git a/greedy_algorithms/huffman.cpp b/greedy_algorithms/huffman.cpp index 253d8d0b5..21c8295f3 100644 --- a/greedy_algorithms/huffman.cpp +++ b/greedy_algorithms/huffman.cpp @@ -1,109 +1,100 @@ -// C++ program for Huffman Coding +// C++ program for Huffman Coding #include -#include -using namespace std; - -// A Huffman tree node -struct MinHeapNode { - - // One of the input characters - char data; - - // Frequency of the character - unsigned freq; - - // Left and right child - MinHeapNode *left, *right; - - MinHeapNode(char data, unsigned freq) - - { - - left = right = NULL; - this->data = data; - this->freq = freq; - } -}; - -// For comparison of -// two heap nodes (needed in min heap) -struct compare { - - bool operator()(MinHeapNode* l, MinHeapNode* r) - - { - return (l->freq > r->freq); - } -}; - -// Prints huffman codes from -// the root of Huffman Tree. -void printCodes(struct MinHeapNode* root, string str) -{ - - if (!root) - return; - - if (root->data != '$') - cout << root->data << ": " << str << "\n"; - - printCodes(root->left, str + "0"); - printCodes(root->right, str + "1"); -} - -// The main function that builds a Huffman Tree and -// print codes by traversing the built Huffman Tree -void HuffmanCodes(char data[], int freq[], int size) -{ - struct MinHeapNode *left, *right, *top; - - // Create a min heap & inserts all characters of data[] - priority_queue, compare> minHeap; - - for (int i = 0; i < size; ++i) - minHeap.push(new MinHeapNode(data[i], freq[i])); - - // Iterate while size of heap doesn't become 1 - while (minHeap.size() != 1) { - - // Extract the two minimum - // freq items from min heap - left = minHeap.top(); - minHeap.pop(); - - right = minHeap.top(); - minHeap.pop(); - - // Create a new internal node with - // frequency equal to the sum of the - // two nodes frequencies. Make the - // two extracted node as left and right children - // of this new node. Add this node - // to the min heap '$' is a special value - // for internal nodes, not used - top = new MinHeapNode('$', left->freq + right->freq); - - top->left = left; - top->right = right; - - minHeap.push(top); - } - - // Print Huffman codes using - // the Huffman tree built above - printCodes(minHeap.top(), ""); -} - -// Driver program to test above functions -int main() -{ - - char arr[] = { 'a', 'b', 'c', 'd', 'e', 'f' }; - int freq[] = { 5, 9, 12, 13, 16, 45 }; - - int size = sizeof(arr) / sizeof(arr[0]); - - HuffmanCodes(arr, freq, size); - - return 0; -} +#include +using namespace std; + +// A Huffman tree node +struct MinHeapNode { + // One of the input characters + char data; + + // Frequency of the character + unsigned freq; + + // Left and right child + MinHeapNode *left, *right; + + MinHeapNode(char data, unsigned freq) + + { + left = right = NULL; + this->data = data; + this->freq = freq; + } +}; + +// For comparison of +// two heap nodes (needed in min heap) +struct compare { + bool operator()(MinHeapNode* l, MinHeapNode* r) + + { + return (l->freq > r->freq); + } +}; + +// Prints huffman codes from +// the root of Huffman Tree. +void printCodes(struct MinHeapNode* root, string str) { + if (!root) + return; + + if (root->data != '$') + cout << root->data << ": " << str << "\n"; + + printCodes(root->left, str + "0"); + printCodes(root->right, str + "1"); +} + +// The main function that builds a Huffman Tree and +// print codes by traversing the built Huffman Tree +void HuffmanCodes(char data[], int freq[], int size) { + struct MinHeapNode *left, *right, *top; + + // Create a min heap & inserts all characters of data[] + priority_queue, compare> minHeap; + + for (int i = 0; i < size; ++i) + minHeap.push(new MinHeapNode(data[i], freq[i])); + + // Iterate while size of heap doesn't become 1 + while (minHeap.size() != 1) { + // Extract the two minimum + // freq items from min heap + left = minHeap.top(); + minHeap.pop(); + + right = minHeap.top(); + minHeap.pop(); + + // Create a new internal node with + // frequency equal to the sum of the + // two nodes frequencies. Make the + // two extracted node as left and right children + // of this new node. Add this node + // to the min heap '$' is a special value + // for internal nodes, not used + top = new MinHeapNode('$', left->freq + right->freq); + + top->left = left; + top->right = right; + + minHeap.push(top); + } + + // Print Huffman codes using + // the Huffman tree built above + printCodes(minHeap.top(), ""); +} + +// Driver program to test above functions +int main() { + char arr[] = {'a', 'b', 'c', 'd', 'e', 'f'}; + int freq[] = {5, 9, 12, 13, 16, 45}; + + int size = sizeof(arr) / sizeof(arr[0]); + + HuffmanCodes(arr, freq, size); + + return 0; +} diff --git a/greedy_algorithms/knapsack.cpp b/greedy_algorithms/knapsack.cpp new file mode 100644 index 000000000..74be4fee0 --- /dev/null +++ b/greedy_algorithms/knapsack.cpp @@ -0,0 +1,78 @@ +#include +using namespace std; + +struct Item { + int weight; + int profit; +}; + +float profitPerUnit(Item x) { return (float)x.profit / (float)x.weight; } + +int partition(Item arr[], int low, int high) { + Item pivot = arr[high]; // pivot + int i = (low - 1); // Index of smaller element + + for (int j = low; j < high; j++) { + // If current element is smaller than or + // equal to pivot + if (profitPerUnit(arr[j]) <= profitPerUnit(pivot)) { + i++; // increment index of smaller element + Item temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + } + Item temp = arr[i + 1]; + arr[i + 1] = arr[high]; + arr[high] = temp; + return (i + 1); +} + +void quickSort(Item arr[], int low, int high) { + if (low < high) { + int p = partition(arr, low, high); + + quickSort(arr, low, p - 1); + quickSort(arr, p + 1, high); + } +} + +int main() { + cout << "\nEnter the capacity of the knapsack : "; + float capacity; + cin >> capacity; + cout << "\n Enter the number of Items : "; + int n; + cin >> n; + Item itemArray[n]; + for (int i = 0; i < n; i++) { + cout << "\nEnter the weight and profit of item " << i + 1 << " : "; + cin >> itemArray[i].weight; + cin >> itemArray[i].profit; + } + + quickSort(itemArray, 0, n - 1); + + // show(itemArray, n); + + float maxProfit = 0; + int i = n; + while (capacity > 0 && --i >= 0) { + if (capacity >= itemArray[i].weight) { + maxProfit += itemArray[i].profit; + capacity -= itemArray[i].weight; + cout << "\n\t" << itemArray[i].weight << "\t" + << itemArray[i].profit; + } else { + maxProfit += profitPerUnit(itemArray[i]) * capacity; + cout << "\n\t" << capacity << "\t" + << profitPerUnit(itemArray[i]) * capacity; + capacity = 0; + break; + } + } + + cout << "\nMax Profit : " << maxProfit; + + return 0; +} diff --git a/greedy_algorithms/kruskals_minimum_spanning_tree.cpp b/greedy_algorithms/kruskals_minimum_spanning_tree.cpp new file mode 100644 index 000000000..9f35e86ac --- /dev/null +++ b/greedy_algorithms/kruskals_minimum_spanning_tree.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; + +#define V 6 +#define INFINITY 99999 + +int graph[V][V] = {{0, 4, 1, 4, INFINITY, INFINITY}, + {4, 0, 3, 8, 3, INFINITY}, + {1, 3, 0, INFINITY, 1, INFINITY}, + {4, 8, INFINITY, 0, 5, 7}, + {INFINITY, 3, 1, 5, 0, INFINITY}, + {INFINITY, INFINITY, INFINITY, 7, INFINITY, 0}}; + +void findMinimumEdge() { + for (int i = 0; i < V; i++) { + int min = INFINITY; + int minIndex = 0; + for (int j = 0; j < V; j++) { + if (graph[i][j] != 0 && graph[i][j] < min) { + min = graph[i][j]; + minIndex = j; + } + } + cout << i << " - " << minIndex << "\t" << graph[i][minIndex] << "\n"; + } +} + +int main() { + findMinimumEdge(); + return 0; +} diff --git a/greedy_algorithms/prims_minimum_spanning_tree.cpp b/greedy_algorithms/prims_minimum_spanning_tree.cpp new file mode 100644 index 000000000..c804c176d --- /dev/null +++ b/greedy_algorithms/prims_minimum_spanning_tree.cpp @@ -0,0 +1,64 @@ +#include +using namespace std; + +#define V 4 +#define INFINITY 99999 + +int graph[V][V] = {{0, 5, 1, 2}, {5, 0, 3, 3}, {1, 3, 0, 4}, {2, 3, 4, 0}}; + +struct mst { + bool visited; + int key; + int near; +}; + +mst MST_Array[V]; + +void initilize() { + for (int i = 0; i < V; i++) { + MST_Array[i].visited = false; + MST_Array[i].key = INFINITY; // considering INFINITY as inifinity + MST_Array[i].near = i; + } + + MST_Array[0].key = 0; +} + +void updateNear() { + for (int v = 0; v < V; v++) { + int min = INFINITY; + int minIndex = 0; + for (int i = 0; i < V; i++) { + if (MST_Array[i].key < min && MST_Array[i].visited == false && + MST_Array[i].key != INFINITY) { + min = MST_Array[i].key; + minIndex = i; + } + } + + MST_Array[minIndex].visited = true; + + for (int i = 0; i < V; i++) { + if (graph[minIndex][i] != 0 && graph[minIndex][i] < INFINITY) { + if (graph[minIndex][i] < MST_Array[i].key) { + MST_Array[i].key = graph[minIndex][i]; + MST_Array[i].near = minIndex; + } + } + } + } +} + +void show() { + for (int i = 0; i < V; i++) { + cout << i << " - " << MST_Array[i].near << "\t" + << graph[i][MST_Array[i].near] << "\n"; + } +} + +int main() { + initilize(); + updateNear(); + show(); + return 0; +} diff --git a/hashing/Chaining.cpp b/hashing/Chaining.cpp deleted file mode 100644 index 55aa8961c..000000000 --- a/hashing/Chaining.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include -using namespace std; - -struct Node -{ - int data; - struct Node *next; -} * head[100], *curr; - -void init() -{ - for (int i = 0; i < 100; i++) - head[i] = NULL; -} - -void add(int x, int h) -{ - struct Node *temp = new Node; - temp->data = x; - temp->next = NULL; - if (!head[h]) - { - head[h] = temp; - curr = head[h]; - } - else - { - curr = head[h]; - while (curr->next) - curr = curr->next; - curr->next = temp; - } -} - -void display(int mod) -{ - struct Node *temp; - int i; - for (i = 0; i < mod; i++) - { - if (!head[i]) - { - cout << "Key " << i << " is empty" << endl; - } - else - { - cout << "Key " << i << " has values = "; - temp = head[i]; - while (temp->next) - { - cout << temp->data << " "; - temp = temp->next; - } - cout << temp->data; - cout << endl; - } - } -} - -int hash(int x, int mod) -{ - return x % mod; -} - -void find(int x, int h) -{ - struct Node *temp = head[h]; - if (!head[h]) - { - cout << "Element not found"; - return; - } - while (temp->data != x && temp->next) - temp = temp->next; - if (temp->next) - cout << "Element found"; - else - { - if (temp->data == x) - cout << "Element found"; - else - cout << "Element not found"; - } -} - -int main(void) -{ - init(); - int c, x, mod, h; - cout << "Enter the size of Hash Table. = "; - cin >> mod; - bool loop = true; - while (loop) - { - cout << endl; - cout << "PLEASE CHOOSE -" << endl; - cout << "1. Add element." << endl; - cout << "2. Find element." << endl; - cout << "3. Generate Hash." << endl; - cout << "4. Display Hash table." << endl; - cout << "5. Exit." << endl; - cin >> c; - switch (c) - { - case 1: - cout << "Enter element to add = "; - cin >> x; - h = hash(x, mod); - h = fabs(h); - add(x, h); - break; - case 2: - cout << "Enter element to search = "; - cin >> x; - h = hash(x, mod); - find(x, h); - break; - case 3: - cout << "Enter element to generate hash = "; - cin >> x; - cout << "Hash of " << x << " is = " << hash(x, mod); - break; - case 4: - display(mod); - break; - default: - loop = false; - break; - } - cout << endl; - } - /*add(1,&head1); - add(2,&head1); - add(3,&head2); - add(5,&head1); - display(&head1); - display(&head2);*/ - return 0; -} \ No newline at end of file diff --git a/hashing/chaining.cpp b/hashing/chaining.cpp new file mode 100644 index 000000000..6afd2d13b --- /dev/null +++ b/hashing/chaining.cpp @@ -0,0 +1,116 @@ +#include +#include +using namespace std; + +struct Node { + int data; + struct Node *next; +} * head[100], *curr; + +void init() { + for (int i = 0; i < 100; i++) head[i] = NULL; +} + +void add(int x, int h) { + struct Node *temp = new Node; + temp->data = x; + temp->next = NULL; + if (!head[h]) { + head[h] = temp; + curr = head[h]; + } else { + curr = head[h]; + while (curr->next) curr = curr->next; + curr->next = temp; + } +} + +void display(int mod) { + struct Node *temp; + int i; + for (i = 0; i < mod; i++) { + if (!head[i]) { + cout << "Key " << i << " is empty" << endl; + } else { + cout << "Key " << i << " has values = "; + temp = head[i]; + while (temp->next) { + cout << temp->data << " "; + temp = temp->next; + } + cout << temp->data; + cout << endl; + } + } +} + +int hash(int x, int mod) { return x % mod; } + +void find(int x, int h) { + struct Node *temp = head[h]; + if (!head[h]) { + cout << "Element not found"; + return; + } + while (temp->data != x && temp->next) temp = temp->next; + if (temp->next) + cout << "Element found"; + else { + if (temp->data == x) + cout << "Element found"; + else + cout << "Element not found"; + } +} + +int main(void) { + init(); + int c, x, mod, h; + cout << "Enter the size of Hash Table. = "; + cin >> mod; + bool loop = true; + while (loop) { + cout << endl; + cout << "PLEASE CHOOSE -" << endl; + cout << "1. Add element." << endl; + cout << "2. Find element." << endl; + cout << "3. Generate Hash." << endl; + cout << "4. Display Hash table." << endl; + cout << "5. Exit." << endl; + cin >> c; + switch (c) { + case 1: + cout << "Enter element to add = "; + cin >> x; + h = hash(x, mod); + h = fabs(h); + add(x, h); + break; + case 2: + cout << "Enter element to search = "; + cin >> x; + h = hash(x, mod); + find(x, h); + break; + case 3: + cout << "Enter element to generate hash = "; + cin >> x; + cout << "Hash of " << x << " is = " << hash(x, mod); + break; + case 4: + display(mod); + break; + default: + loop = false; + break; + } + cout << endl; + } + /*add(1,&head1); + add(2,&head1); + add(3,&head2); + add(5,&head1); + display(&head1); + display(&head2);*/ + return 0; +} \ No newline at end of file diff --git a/hashing/double_hash_hash_table.cpp b/hashing/double_hash_hash_table.cpp index 6030b7ff3..7ee2757de 100644 --- a/hashing/double_hash_hash_table.cpp +++ b/hashing/double_hash_hash_table.cpp @@ -1,13 +1,13 @@ // Copyright 2019 -#include -#include -#include -#include +#include +#include +#include +#include -using std::endl; -using std::cout; using std::cin; +using std::cout; +using std::endl; using std::string; // fwd declarations @@ -48,8 +48,8 @@ int doubleHash(int key, bool searching) { int i = 0; Entry entry; do { - int index = static_cast(fabs((hash + - (i * otherHashFxn(key))))) % totalSize; + int index = static_cast(fabs((hash + (i * otherHashFxn(key))))) % + totalSize; entry = table[index]; if (searching) { if (entry.key == notPresent) { @@ -63,12 +63,17 @@ int doubleHash(int key, bool searching) { i++; } else { if (putProber(entry, key)) { - if (!rehashing) cout << "Spot found!" << endl; + if (!rehashing) + cout << "Spot found!" << endl; return index; } - if (!rehashing) cout << "Spot taken, looking at next (next index:" - << " " << static_cast(fabs((hash + - (i * otherHashFxn(key))))) % totalSize << ")" << endl; + if (!rehashing) + cout << "Spot taken, looking at next (next index:" + << " " + << static_cast( + fabs((hash + (i * otherHashFxn(key))))) % + totalSize + << ")" << endl; i++; } if (i == totalSize * 100) { @@ -89,7 +94,8 @@ bool putProber(Entry entry, int key) { // Looks for a matching key bool searchingProber(Entry entry, int key) { - if (entry.key == key) return true; + if (entry.key == key) + return true; return false; } @@ -131,12 +137,12 @@ void rehash() { // Checks for load factor here void add(int key) { - Entry * entry = new Entry(); + Entry* entry = new Entry(); entry->key = key; int index = doubleHash(key, false); table[index] = *entry; // Load factor greater than 0.5 causes resizing - if (++size/ static_cast(totalSize) >= 0.5) { + if (++size / static_cast(totalSize) >= 0.5) { rehash(); } } @@ -157,8 +163,8 @@ void addInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) - << " % " << totalSize << " == " << fabs(hashFxn(key) % totalSize); + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << fabs(hashFxn(key) % totalSize); cout << endl; add(key); cout << "New table: "; @@ -170,8 +176,8 @@ void removalInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) - << " % " << totalSize << " == " << hashFxn(key) % totalSize; + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << hashFxn(key) % totalSize; cout << endl; remove(key); cout << "New table: "; diff --git a/hashing/linear_probing_hash_table.cpp b/hashing/linear_probing_hash_table.cpp index b00eb8641..393504c1d 100644 --- a/hashing/linear_probing_hash_table.cpp +++ b/hashing/linear_probing_hash_table.cpp @@ -1,13 +1,13 @@ // Copyright 2019 -#include -#include -#include -#include +#include +#include +#include +#include -using std::endl; -using std::cout; using std::cin; +using std::cout; +using std::endl; using std::string; // fwd declarations @@ -56,10 +56,12 @@ int linearProbe(int key, bool searching) { i++; } else { if (putProber(entry, key)) { - if (!rehashing) cout << "Spot found!" << endl; + if (!rehashing) + cout << "Spot found!" << endl; return index; } - if (!rehashing) cout << "Spot taken, looking at next" << endl; + if (!rehashing) + cout << "Spot taken, looking at next" << endl; i++; } if (i == totalSize) { @@ -80,7 +82,8 @@ bool putProber(Entry entry, int key) { // Looks for a matching key bool searchingProber(Entry entry, int key) { - if (entry.key == key) return true; + if (entry.key == key) + return true; return false; } @@ -122,12 +125,12 @@ void rehash() { // Adds entry using linear probing. Checks for load factor here void add(int key) { - Entry * entry = new Entry(); + Entry* entry = new Entry(); entry->key = key; int index = linearProbe(key, false); table[index] = *entry; // Load factor greater than 0.5 causes resizing - if (++size/ static_cast(totalSize) >= 0.5) { + if (++size / static_cast(totalSize) >= 0.5) { rehash(); } } @@ -148,8 +151,8 @@ void addInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) << " % " - << totalSize << " == " << fabs(hashFxn(key) % totalSize); + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << fabs(hashFxn(key) % totalSize); cout << endl; add(key); cout << "New table: "; @@ -161,8 +164,8 @@ void removalInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) - << " % " << totalSize << " == " << hashFxn(key) % totalSize; + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << hashFxn(key) % totalSize; cout << endl; remove(key); cout << "New table: "; diff --git a/hashing/quadratic_probing_hash_table.cpp b/hashing/quadratic_probing_hash_table.cpp index 44e2e3b9f..971c2182d 100644 --- a/hashing/quadratic_probing_hash_table.cpp +++ b/hashing/quadratic_probing_hash_table.cpp @@ -1,14 +1,14 @@ // Copyright 2019 -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -using std::endl; -using std::cout; using std::cin; +using std::cout; +using std::endl; using std::string; // fwd declarations @@ -43,8 +43,8 @@ int quadraticProbe(int key, bool searching) { int i = 0; Entry entry; do { - int index = std::round(fabs((hash + - static_cast(std::round(std::pow(i, 2)))) % totalSize)); + int index = std::round(fabs( + (hash + static_cast(std::round(std::pow(i, 2)))) % totalSize)); entry = table[index]; if (searching) { if (entry.key == notPresent) { @@ -58,13 +58,16 @@ int quadraticProbe(int key, bool searching) { i++; } else { if (putProber(entry, key)) { - if (!rehashing) cout << "Spot found!" << endl; + if (!rehashing) + cout << "Spot found!" << endl; return index; } if (!rehashing) { - cout << "Spot taken, looking at next (next index = " << - std::round(fabs((hash + static_cast(std::round( - std::pow(i + 1, 2)))) % totalSize)) << endl; + cout << "Spot taken, looking at next (next index = " + << std::round(fabs((hash + static_cast(std::round( + std::pow(i + 1, 2)))) % + totalSize)) + << endl; } i++; } @@ -86,14 +89,16 @@ bool putProber(Entry entry, int key) { // Looks for a matching key bool searchingProber(Entry entry, int key) { - if (entry.key == key) return true; + if (entry.key == key) + return true; return false; } // Helper Entry find(int key) { int index = quadraticProbe(key, true); - if (index == notPresent) return Entry(); + if (index == notPresent) + return Entry(); return table[index]; } @@ -135,12 +140,12 @@ void rehash() { // Checks for load factor here void add(int key) { - Entry * entry = new Entry(); + Entry* entry = new Entry(); entry->key = key; int index = quadraticProbe(key, false); table[index] = *entry; // Load factor greater than 0.5 causes resizing - if (++size/ static_cast(totalSize) >= 0.5) { + if (++size / static_cast(totalSize) >= 0.5) { rehash(); } } @@ -161,8 +166,8 @@ void addInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) << " % " - << totalSize << " == " << fabs(hashFxn(key) % totalSize); + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << fabs(hashFxn(key) % totalSize); cout << endl; add(key); cout << "New table: "; @@ -174,8 +179,8 @@ void removalInfo(int key) { cout << "Initial table: "; display(); cout << endl; - cout << "hash of " << key << " is " << hashFxn(key) - << " % " << totalSize << " == " << hashFxn(key) % totalSize; + cout << "hash of " << key << " is " << hashFxn(key) << " % " << totalSize + << " == " << hashFxn(key) % totalSize; cout << endl; remove(key); cout << "New table: "; diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt new file mode 100644 index 000000000..2b70b2d31 --- /dev/null +++ b/math/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/math") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/math/README.md b/math/README.md index 4ac39c878..d7b862f9f 100644 --- a/math/README.md +++ b/math/README.md @@ -1,3 +1,4 @@ +# Prime factorization # {#section} Prime Factorization is a very important and useful technique to factorize any number into its prime factors. It has various applications in the field of number theory. The method of prime factorization involves two function calls. diff --git a/math/binary_exponent.cpp b/math/binary_exponent.cpp index b4551da25..05e6f33f7 100644 --- a/math/binary_exponent.cpp +++ b/math/binary_exponent.cpp @@ -1,46 +1,57 @@ -/// C++ Program to find Binary Exponent Iteratively and Recursively. - -#include -/* - * Calculate a^b in O(log(b)) by converting b to a binary number. - * Binary exponentiation is also known as exponentiation by squaring. - * NOTE : This is a far better approach compared to naive method which provide O(b) operations. +/** + * @file + * @brief C++ Program to find Binary Exponent Iteratively and Recursively. + * + * Calculate \f$a^b\f$ in \f$O(\log(b))\f$ by converting \f$b\f$ to a + * binary number. Binary exponentiation is also known as exponentiation by + * squaring. + * @note This is a far better approach compared to naive method which + * provide \f$O(b)\f$ operations. + * * Example: - * 10 in base 2 is 1010. - * 2^10 = 2^(1010) = 2^8 * 2^2 - * 2^1 = 2 - * 2^2 = (2^1)^2 = 2^2 = 4 - * 2^4 = (2^2)^2 = 4^2 = 16 - * 2^8 = (2^4)^2 = 16^2 = 256 - * Hence to calculate 2^10 we only need to multiply 2^8 and 2^2 skipping 2^1 and 2^4. -*/ + *
10 in base 2 is 1010. + * \f{eqnarray*}{ + * 2^{10_d} &=& 2^{1010_b} = 2^8 * 2^2\\ + * 2^1 &=& 2\\ + * 2^2 &=& (2^1)^2 = 2^2 = 4\\ + * 2^4 &=& (2^2)^2 = 4^2 = 16\\ + * 2^8 &=& (2^4)^2 = 16^2 = 256\\ + * \f} + * Hence to calculate 2^10 we only need to multiply \f$2^8\f$ and \f$2^2\f$ + * skipping \f$2^1\f$ and \f$2^4\f$. + */ -/// Recursive function to calculate exponent in O(log(n)) using binary exponent. +#include + +/// Recursive function to calculate exponent in \f$O(\log(n))\f$ using binary +/// exponent. int binExpo(int a, int b) { if (b == 0) { return 1; } - int res = binExpo(a, b/2); - if (b%2) { - return res*res*a; + int res = binExpo(a, b / 2); + if (b % 2) { + return res * res * a; } else { - return res*res; + return res * res; } } -/// Iterative function to calculate exponent in O(log(n)) using binary exponent. +/// Iterative function to calculate exponent in \f$O(\log(n))\f$ using binary +/// exponent. int binExpo_alt(int a, int b) { int res = 1; while (b > 0) { - if (b%2) { - res = res*a; + if (b % 2) { + res = res * a; } - a = a*a; + a = a * a; b /= 2; } return res; } +/// Main function int main() { int a, b; /// Give two numbers a, b diff --git a/math/double_factorial.cpp b/math/double_factorial.cpp index 7b0d1d970..8e5ffcefa 100644 --- a/math/double_factorial.cpp +++ b/math/double_factorial.cpp @@ -1,28 +1,41 @@ -#include +/** + * @file + * @brief Compute double factorial: \f$n!!\f$ + * + * Double factorial of a non-negative integer n, is defined as the product of + * all the integers from 1 to n that have the same parity (odd or even) as n. + *
It is also called as semifactorial of a number and is denoted by + * \f$n!!\f$ + */ + #include +#include -/* Double factorial of a non-negative integer n, is defined as the product of -all the integers from 1 to n that have the same parity (odd or even) as n. -It is also called as semifactorial of a number and is denoted by !! */ - +/** Compute double factorial using iterative method + */ uint64_t double_factorial_iterative(uint64_t n) { - uint64_t res = 1; - for ( uint64_t i = n; i >= 0; i -= 2 ) { - if (i == 0 || i == 1) return res; - res *= i; - } + uint64_t res = 1; + for (uint64_t i = n;; i -= 2) { + if (i == 0 || i == 1) + return res; + res *= i; + } + return res; } -/* Recursion can be costly for large numbers */ - +/** Compute double factorial using resursive method. + *
Recursion can be costly for large numbers. + */ uint64_t double_factorial_recursive(uint64_t n) { - if (n <= 1) return 1; - return n * double_factorial_recursive(n - 2); + if (n <= 1) + return 1; + return n * double_factorial_recursive(n - 2); } +/// main function int main() { - uint64_t n{}; - std::cin >> n; - assert(n >= 0); - std::cout << double_factorial_iterative(n); + uint64_t n; + std::cin >> n; + assert(n >= 0); + std::cout << double_factorial_iterative(n); } diff --git a/math/eulers_totient_function.cpp b/math/eulers_totient_function.cpp index 31ced5a51..8283ab045 100644 --- a/math/eulers_totient_function.cpp +++ b/math/eulers_totient_function.cpp @@ -1,28 +1,37 @@ -/// C++ Program to find Euler Totient Function -#include - -/* +/** + * @file + * @brief C++ Program to find + * [Euler's Totient](https://en.wikipedia.org/wiki/Euler%27s_totient_function) + * function + * * Euler Totient Function is also known as phi function. - * phi(n) = phi(p1^a1).phi(p2^a2)... - * where p1, p2,... are prime factors of n. - * 3 Euler's properties: - * 1. phi(prime_no) = prime_no-1 - * 2. phi(prime_no^k) = (prime_no^k - prime_no^(k-1)) - * 3. phi(a,b) = phi(a). phi(b) where a and b are relative primes. + * \f[\phi(n) = + * \phi\left({p_1}^{a_1}\right)\cdot\phi\left({p_2}^{a_2}\right)\ldots\f] where + * \f$p_1\f$, \f$p_2\f$, \f$\ldots\f$ are prime factors of n. + *
3 Euler's properties: + * 1. \f$\phi(n) = n-1\f$ + * 2. \f$\phi(n^k) = n^k - n^{k-1}\f$ + * 3. \f$\phi(a,b) = \phi(a)\cdot\phi(b)\f$ where a and b are relative primes. + * * Applying this 3 properties on the first equation. - * phi(n) = n. (1-1/p1). (1-1/p2). ... - * where p1,p2... are prime factors. - * Hence Implementation in O(sqrt(n)). - * phi(100) = 40 - * phi(1) = 1 - * phi(17501) = 15120 - * phi(1420) = 560 + * \f[\phi(n) = + * n\cdot\left(1-\frac{1}{p_1}\right)\cdot\left(1-\frac{1}{p_2}\right)\cdots\f] + * where \f$p_1\f$,\f$p_2\f$... are prime factors. + * Hence Implementation in \f$O\left(\sqrt{n}\right)\f$. + *
Some known values are: + * * \f$\phi(100) = 40\f$ + * * \f$\phi(1) = 1\f$ + * * \f$\phi(17501) = 15120\f$ + * * \f$\phi(1420) = 560\f$ */ +#include +#include -// Function to caculate Euler's totient phi -int phiFunction(int n) { - int result = n; - for (int i = 2; i * i <= n; i++) { +/** Function to caculate Euler's totient phi + */ +uint64_t phiFunction(uint64_t n) { + uint64_t result = n; + for (uint64_t i = 2; i * i <= n; i++) { if (n % i == 0) { while (n % i == 0) { n /= i; @@ -30,12 +39,20 @@ int phiFunction(int n) { result -= result / i; } } - if (n > 1) result -= result / n; + if (n > 1) + result -= result / n; return result; } -int main() { - int n; +/// Main function +int main(int argc, char *argv[]) { + uint64_t n; + if (argc < 2) { + std::cout << "Enter the number: "; + } else { + n = strtoull(argv[1], nullptr, 10); + } std::cin >> n; std::cout << phiFunction(n); + return 0; } diff --git a/math/extended_euclid_algorithm.cpp b/math/extended_euclid_algorithm.cpp index 3db14802f..9fdc9692e 100644 --- a/math/extended_euclid_algorithm.cpp +++ b/math/extended_euclid_algorithm.cpp @@ -1,28 +1,96 @@ +/** + * @file + * @brief GCD using [extended Euclid's algorithm] + * (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm) + * + * Finding coefficients of a and b ie x and y in Bézout's identity + * \f[\text{gcd}(a, b) = a \times x + b \times y \f] + * This is also used in finding Modular + * multiplicative inverse of a number. (A * B)%M == 1 Here B is the MMI of A for + * given M, so extendedEuclid (A, M) gives B. + */ +#include // for swap function #include -// Finding coefficients of a and b ie x and y in gcd(a, b) = a * x + b * y -// d is gcd(a, b) -// This is also used in finding Modular multiplicative inverse of a number. -// (A * B)%M == 1 Here B is the MMI of A for given M, -// so extendedEuclid (A, M) gives B. -int d, x, y; -void extendedEuclid(int A, int B) { +/** + * function to update the coefficients per iteration + * \f[r_0,\,r = r,\, r_0 - \text{quotient}\times r\f] + * + * @param[in,out] r signed or unsigned + * @param[in,out] r0 signed or unsigned + * @param[in] quotient unsigned + */ +template +inline void update_step(T *r, T *r0, const T2 quotient) { + T temp = *r; + *r = *r0 - (quotient * temp); + *r0 = temp; +} + +/** + * Implementation using iterative algorithm from + * [Wikipedia](https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Pseudocode) + * + * @param[in] A unsigned + * @param[in] B unsigned + * @param[out] GCD unsigned + * @param[out] x signed + * @param[out] y signed + */ +template +void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y) { + if (B > A) + std::swap(A, B); // Ensure that A >= B + + T2 s = 0, s0 = 1; + T2 t = 1, t0 = 0; + T1 r = B, r0 = A; + + while (r != 0) { + T1 quotient = r0 / r; + update_step(&r, &r0, quotient); + update_step(&s, &s0, quotient); + update_step(&t, &t0, quotient); + } + *GCD = r0; + *x = s0; + *y = t0; +} + +/** + * Implementation using recursive algorithm + * + * @param[in] A unsigned + * @param[in] B unsigned + * @param[out] GCD unsigned + * @param[in,out] x signed + * @param[in,out] y signed + */ +template +void extendedEuclid(T A, T B, T *GCD, T2 *x, T2 *y) { + if (B > A) + std::swap(A, B); // Ensure that A >= B + if (B == 0) { - d = A; - x = 1; - y = 0; + *GCD = A; + *x = 1; + *y = 0; } else { - extendedEuclid(B, A%B); - int temp = x; - x = y; - y = temp - (A/B)*y; + extendedEuclid(B, A % B, GCD, x, y); + T2 temp = *x; + *x = *y; + *y = temp - (A / B) * (*y); } } +/// Main function int main() { - int a, b; + uint32_t a, b, gcd; + int32_t x, y; std::cin >> a >> b; - extendedEuclid(a, b); - std::cout << x << " " << y << std::endl; + extendedEuclid(a, b, &gcd, &x, &y); + std::cout << gcd << " " << x << " " << y << std::endl; + extendedEuclid_1(a, b, &gcd, &x, &y); + std::cout << gcd << " " << x << " " << y << std::endl; return 0; } diff --git a/math/factorial.cpp b/math/factorial.cpp index 8b13eb52d..353f0b16b 100644 --- a/math/factorial.cpp +++ b/math/factorial.cpp @@ -1,14 +1,17 @@ -// C++ program to find factorial of given number -#include +/** + * @file + * @brief C++ program to find factorial of given number + */ +#include -// function to find factorial of given number +/** function to find factorial of given number */ unsigned int factorial(unsigned int n) { if (n == 0) return 1; return n * factorial(n - 1); } -// Driver code +/** Main function */ int main() { int num = 5; std::cout << "Factorial of " << num << " is " << factorial(num) diff --git a/math/fast_power.cpp b/math/fast_power.cpp index 4f6e02081..c5621cd4e 100644 --- a/math/fast_power.cpp +++ b/math/fast_power.cpp @@ -1,29 +1,40 @@ -#include -#include -#include +/** + * @file + * @brief Faster computation for \f$a^b\f$ + * + * Program that computes \f$a^b\f$ in \f$O(logN)\f$ time. + * It is based on formula that: + * 1. if \f$b\f$ is even: + * \f$a^b = a^\frac{b}{2} \cdot a^\frac{b}{2} = {a^\frac{b}{2}}^2\f$ + * 2. if \f$b\f$ is odd: \f$a^b = a^\frac{b-1}{2} + * \cdot a^\frac{b-1}{2} \cdot a = {a^\frac{b-1}{2}}^2 \cdot a\f$ + * + * We can compute \f$a^b\f$ recursively using above algorithm. + */ + #include -#include #include +#include +#include +#include +#include -/* - Program that computes a^b in O(logN) time. - It is based on formula that: - case1) if b is even: a^b = a^(b/2) * a^(b/2) = (a^(b/2))ˆ2 - case2) if b is odd: a^b = a^((b-1)/2) * a^((b-1)/2) * a = (a^((b-1)/2))^2 * a - We can compute a^b recursively using above algorithm. -*/ - -double fast_power_recursive(int64_t a, int64_t b) { +/** + * algorithm implementation for \f$a^b\f$ + */ +template +double fast_power_recursive(T a, T b) { // negative power. a^b = 1 / (a^-b) if (b < 0) return 1.0 / fast_power_recursive(a, -b); - if (b == 0) return 1; - int64_t bottom = fast_power_recursive(a, b >> 1); + if (b == 0) + return 1; + T bottom = fast_power_recursive(a, b >> 1); // Since it is integer division b/2 = (b-1)/2 where b is odd. // Therefore, case2 is easily solved by integer division. - int64_t result; + double result; if ((b & 1) == 0) // case1 result = bottom * bottom; else // case2 @@ -31,49 +42,52 @@ double fast_power_recursive(int64_t a, int64_t b) { return result; } -/* +/** Same algorithm with little different formula. - It still calculates in O(logN) + It still calculates in \f$O(\log N)\f$ */ -double fast_power_linear(int64_t a, int64_t b) { +template +double fast_power_linear(T a, T b) { // negative power. a^b = 1 / (a^-b) if (b < 0) return 1.0 / fast_power_linear(a, -b); double result = 1; while (b) { - if (b & 1) result = result * a; + if (b & 1) + result = result * a; a = a * a; b = b >> 1; } return result; } +/** + * Main function + */ int main() { - std::srand(time(NULL)); + std::srand(std::time(nullptr)); std::ios_base::sync_with_stdio(false); std::cout << "Testing..." << std::endl; for (int i = 0; i < 20; i++) { - unsigned int *rand1, *rand2; - int a = rand_r(rand1) % 20 - 10; - int b = rand_r(rand2) % 20 - 10; + int a = std::rand() % 20 - 10; + int b = std::rand() % 20 - 10; std::cout << std::endl << "Calculating " << a << "^" << b << std::endl; assert(fast_power_recursive(a, b) == std::pow(a, b)); assert(fast_power_linear(a, b) == std::pow(a, b)); - std::cout << "------ " << a << "^" << b << " = "<< - fast_power_recursive(a, b) << std::endl; + std::cout << "------ " << a << "^" << b << " = " + << fast_power_recursive(a, b) << std::endl; } int64_t a, b; std::cin >> a >> b; - std::cout << a << "^" << b << " = "<< - fast_power_recursive(a, b) << std::endl; + std::cout << a << "^" << b << " = " << fast_power_recursive(a, b) + << std::endl; - std::cout << a << "^" << b << " = "<< - fast_power_linear(a, b) << std::endl; + std::cout << a << "^" << b << " = " << fast_power_linear(a, b) << std::endl; return 0; } diff --git a/math/fibonacci.cpp b/math/fibonacci.cpp index 1c07cd93f..e15cfc0cc 100644 --- a/math/fibonacci.cpp +++ b/math/fibonacci.cpp @@ -1,22 +1,30 @@ -#include +/** + * @file + * @brief Generate fibonacci sequence + * + * Calculate the the value on Fibonacci's sequence given an + * integer as input. + * \f[\text{fib}(n) = \text{fib}(n-1) + \text{fib}(n-2)\f] + * + * @see fibonacci_large.cpp, fibonacci_fast.cpp, string_fibonacci.cpp + */ #include +#include -/* Calculate the the value on Fibonacci's sequence given an -integer as input -Fibonacci = 0, 1, 1, 2, 3, 5, - 8, 13, 21, 34, 55, - 89, 144, ... */ - -int fibonacci(uint n) { +/** + * Recursively compute sequences + */ +int fibonacci(unsigned int n) { /* If the input is 0 or 1 just return the same This will set the first 2 values of the sequence */ if (n <= 1) return n; /* Add the last 2 values of the sequence to get next */ - return fibonacci(n-1) + fibonacci(n-2); + return fibonacci(n - 1) + fibonacci(n - 2); } +/// Main function int main() { int n; std::cin >> n; diff --git a/math/fibonacci_fast.cpp b/math/fibonacci_fast.cpp new file mode 100644 index 000000000..08cced351 --- /dev/null +++ b/math/fibonacci_fast.cpp @@ -0,0 +1,52 @@ +/** + * @file + * @brief Faster computation of Fibonacci series + * + * An efficient way to calculate nth fibonacci number faster and simpler than + * \f$O(n\log n)\f$ method of matrix exponentiation This works by using both + * recursion and dynamic programming. as 93rd fibonacci exceeds 19 digits, which + * cannot be stored in a single long long variable, we can only use it till 92nd + * fibonacci we can use it for 10000th fibonacci etc, if we implement + * bigintegers. This algorithm works with the fact that nth fibonacci can easily + * found if we have already found n/2th or (n+1)/2th fibonacci It is a property + * of fibonacci similar to matrix exponentiation. + * + * @see fibonacci_large.cpp, fibonacci.cpp, string_fibonacci.cpp + */ + +#include +#include +#include + +/** maximum number that can be computed - The result after 93 cannot be stored + * in a `uint64_t` data type. */ +const uint64_t MAX = 93; + +/** Array of computed fibonacci numbers */ +uint64_t f[MAX] = {0}; + +/** Algorithm */ +uint64_t fib(uint64_t n) { + if (n == 0) + return 0; + if (n == 1 || n == 2) + return (f[n] = 1); + + if (f[n]) + return f[n]; + + uint64_t k = (n % 2 != 0) ? (n + 1) / 2 : n / 2; + + f[n] = (n % 2 != 0) ? (fib(k) * fib(k) + fib(k - 1) * fib(k - 1)) + : (2 * fib(k - 1) + fib(k)) * fib(k); + return f[n]; +} + +/** Main function */ +int main() { + // Main Function + for (uint64_t i = 1; i < 93; i++) { + std::cout << i << " th fibonacci number is " << fib(i) << std::endl; + } + return 0; +} diff --git a/math/fibonacci_large.cpp b/math/fibonacci_large.cpp new file mode 100644 index 000000000..d9dbff799 --- /dev/null +++ b/math/fibonacci_large.cpp @@ -0,0 +1,84 @@ +/** + * @file + * @brief Computes N^th Fibonacci number given as + * input argument. Uses custom build arbitrary integers library + * to perform additions and other operations. + * + * Took 0.608246 seconds to compute 50,000^th Fibonacci + * number that contains 10450 digits! + * + * @see fibonacci.cpp, fibonacci_fast.cpp, string_fibonacci.cpp + */ + +#include +#include +#include + +#include "./large_number.h" + +/** Compute fibonacci numbers using the relation + * \f[f(n)=f(n-1)+f(n-2)\f] + * and returns the result as a large_number type. + */ +large_number fib(uint64_t n) { + large_number f0(1); + large_number f1(1); + + do { + large_number f2 = f1; + f1 += f0; + f0 = f2; + n--; + } while (n > 2); // since we start from 2 + + return f1; +} + +int main(int argc, char *argv[]) { + uint64_t N; + if (argc == 2) { + N = strtoull(argv[1], NULL, 10); + } else { + std::cout << "Enter N: "; + std::cin >> N; + } + + clock_t start_time = std::clock(); + large_number result = fib(N); + clock_t end_time = std::clock(); + double time_taken = static_cast(end_time - start_time) / + static_cast(CLOCKS_PER_SEC); + + std::cout << std::endl + << N << "^th Fibonacci number: " << result << std::endl + << "Number of digits: " << result.num_digits() << std::endl + << "Time taken: " << std::scientific << time_taken << " s" + << std::endl; + + N = 5000; + if (fib(N) == + large_number( + "387896845438832563370191630832590531208212771464624510616059721489" + "555013904403709701082291646221066947929345285888297381348310200895" + "498294036143015691147893836421656394410691021450563413370655865623" + "825465670071252592990385493381392883637834751890876297071203333705" + "292310769300851809384980180384781399674888176555465378829164426891" + "298038461377896902150229308247566634622492307188332480328037503913" + "035290330450584270114763524227021093463769910400671417488329842289" + "149127310405432875329804427367682297724498774987455569190770388063" + "704683279481135897373999311010621930814901857081539785437919530561" + "751076105307568878376603366735544525884488624161921055345749367589" + "784902798823435102359984466393485325641195222185956306047536464547" + "076033090242080638258492915645287629157575914234380914230291749108" + "898415520985443248659407979357131684169286803954530954538869811466" + "508206686289742063932343848846524098874239587380197699382031717420" + "893226546887936400263079778005875912967138963421425257911687275560" + "0360311370547754724604639987588046985178408674382863125")) + std::cout << "Test for " << N << "^th Fibonacci number passed!" + << std::endl; + else + std::cerr << "Test for " << N << "^th Fibonacci number failed!" + << std::endl; + + return 0; +} diff --git a/math/greatest_common_divisor_euclidean.cpp b/math/gcd_iterative_euclidean.cpp similarity index 79% rename from math/greatest_common_divisor_euclidean.cpp rename to math/gcd_iterative_euclidean.cpp index c4812e45b..2c0651ad7 100644 --- a/math/greatest_common_divisor_euclidean.cpp +++ b/math/gcd_iterative_euclidean.cpp @@ -1,10 +1,17 @@ -#include +/** + * @file + * @brief Compute the greatest common denominator of two integers using + * *iterative form* of + * [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm) + * + * @see gcd_recursive_euclidean.cpp, gcd_of_n_numbers.cpp + */ #include #include -// will find the greatest common denominator of two ints integers -// Euclidean algorithm can be found here -// https://en.wikipedia.org/wiki/Euclidean_algorithm +/** + * algorithm + */ int gcd(int num1, int num2) { if (num1 <= 0 | num2 <= 0) { throw std::domain_error("Euclidean algorithm domain is for ints > 0"); @@ -34,6 +41,9 @@ int gcd(int num1, int num2) { return previous_remainder; } +/** + * Main function + */ int main() { std::cout << "gcd of 120,7 is " << (gcd(120, 7)) << std::endl; try { diff --git a/math/gcd_of_n_numbers.cpp b/math/gcd_of_n_numbers.cpp new file mode 100644 index 000000000..92968ff12 --- /dev/null +++ b/math/gcd_of_n_numbers.cpp @@ -0,0 +1,41 @@ +/** + * @file + * @brief This program aims at calculating the GCD of n numbers by division + * method + * + * @see gcd_iterative_euclidean.cpp, gcd_recursive_euclidean.cpp + */ +#include + +/** Compute GCD using division algorithm + * + * @param[in] a array of integers to compute GCD for + * @param[in] n number of integers in array `a` + */ +int gcd(int *a, int n) { + int j = 1; // to access all elements of the array starting from 1 + int gcd = a[0]; + while (j < n) { + if (a[j] % gcd == 0) // value of gcd is as needed so far + j++; // so we check for next element + else + gcd = a[j] % gcd; // calculating GCD by division method + } + return gcd; +} + +/** Main function */ +int main() { + int n; + std::cout << "Enter value of n:" << std::endl; + std::cin >> n; + int *a = new int[n]; + int i; + std::cout << "Enter the n numbers:" << std::endl; + for (i = 0; i < n; i++) std::cin >> a[i]; + + std::cout << "GCD of entered n numbers:" << gcd(a, n) << std::endl; + + delete[] a; + return 0; +} diff --git a/math/gcd_recursive_euclidean.cpp b/math/gcd_recursive_euclidean.cpp new file mode 100644 index 000000000..2a3d2183c --- /dev/null +++ b/math/gcd_recursive_euclidean.cpp @@ -0,0 +1,52 @@ +/** + * @file + * @brief Compute the greatest common denominator of two integers using + * *recursive form* of + * [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm) + * + * @see gcd_iterative_euclidean.cpp, gcd_of_n_numbers.cpp + */ +#include + +/** + * algorithm + */ +int gcd(int num1, int num2) { + if (num1 <= 0 | num2 <= 0) { + throw std::domain_error("Euclidean algorithm domain is for ints > 0"); + } + + if (num1 == num2) { + return num1; + } + + // Everything divides 0 + if (num1 == 0) + return num2; + if (num2 == 0) + return num1; + + // base case + if (num1 == num2) + return num1; + + // a is greater + if (num1 > num2) + return gcd(num1 - num2, num2); + return gcd(num1, num2 - num1); +} + +/** + * Main function + */ +int main() { + std::cout << "gcd of 120,7 is " << (gcd(120, 7)) << std::endl; + try { + std::cout << "gcd of -120,10 is " << gcd(-120, 10) << std::endl; + } catch (const std::domain_error &e) { + std::cout << "Error handling was successful" << std::endl; + } + std::cout << "gcd of 312,221 is " << (gcd(312, 221)) << std::endl; + std::cout << "gcd of 289,204 is " << (gcd(289, 204)) << std::endl; + return 0; +} diff --git a/math/greatest_common_divisor.cpp b/math/greatest_common_divisor.cpp deleted file mode 100644 index 5601c4be9..000000000 --- a/math/greatest_common_divisor.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// C++ program to find GCD of two numbers -#include - -// Recursive function to return gcd of a and b -int gcd(int a, int b) { - // Everything divides 0 - if (a == 0) - return b; - if (b == 0) - return a; - - // base case - if (a == b) - return a; - - // a is greater - if (a > b) - return gcd(a-b, b); - return gcd(a, b-a); -} - -// Driver program to test above function -int main() { - int a = 98, b = 56; - std::cout << "GCD of " << a << " and " << b << " is " << gcd(a, b); - return 0; -} diff --git a/math/large_factorial.cpp b/math/large_factorial.cpp new file mode 100644 index 000000000..1027f41ab --- /dev/null +++ b/math/large_factorial.cpp @@ -0,0 +1,117 @@ +/** + * @file + * @brief Compute factorial of any arbitratily large number/ + * + * @see factorial.cpp + */ +#include +#include +#include + +#include "./large_number.h" + +/** Test implementation for 10! Result must be 3628800. + * @returns True if test pass else False + */ +bool test1() { + std::cout << "---- Check 1\t"; + unsigned int i, number = 10; + large_number result; + for (i = 2; i <= number; i++) /* Multiply every number from 2 thru N */ + result *= i; + + const char *known_reslt = "3628800"; + + /* check 1 */ + if (strlen(known_reslt) != result.num_digits()) { + std::cerr << "Result lengths dont match! " << strlen(known_reslt) + << " != " << result.num_digits() << std::endl; + return false; + } + + const size_t N = result.num_digits(); + for (i = 0; i < N; i++) { + if (known_reslt[i] != result.digit_char(i)) { + std::cerr << i << "^th digit mismatch! " << known_reslt[i] + << " != " << result.digit_char(i) << std::endl; + return false; + } + } + + std::cout << "Passed!" << std::endl; + return true; +} + +/** Test implementation for 100! The result is the 156 digit number: + * ``` + * 9332621544394415268169923885626670049071596826438162146859296389521759 + * 9993229915608941463976156518286253697920827223758251185210916864000000 + * 000000000000000000 + * ``` + * @returns True if test pass else False + */ +bool test2() { + std::cout << "---- Check 2\t"; + unsigned int i, number = 100; + large_number result; + for (i = 2; i <= number; i++) /* Multiply every number from 2 thru N */ + result *= i; + + const char *known_reslt = + "9332621544394415268169923885626670049071596826438162146859296389521759" + "9993229915608941463976156518286253697920827223758251185210916864000000" + "000000000000000000"; + + /* check 1 */ + if (strlen(known_reslt) != result.num_digits()) { + std::cerr << "Result lengths dont match! " << strlen(known_reslt) + << " != " << result.num_digits() << std::endl; + return false; + } + + const size_t N = result.num_digits(); + for (i = 0; i < N; i++) { + if (known_reslt[i] != result.digit_char(i)) { + std::cerr << i << "^th digit mismatch! " << known_reslt[i] + << " != " << result.digit_char(i) << std::endl; + return false; + } + } + + std::cout << "Passed!" << std::endl; + return true; +} + +/** + * Main program + **/ +int main(int argc, char *argv[]) { + int number, i; + + if (argc == 2) { + number = atoi(argv[1]); + } else { + std::cout << "Enter the value of n(n starts from 0 ): "; + std::cin >> number; + } + + large_number result; + + std::clock_t start_time = std::clock(); + for (i = 2; i <= number; i++) /* Multiply every number from 2 thru N */ + result *= i; + std::clock_t end_time = std::clock(); + double time_taken = + static_cast(end_time - start_time) / CLOCKS_PER_SEC; + + std::cout << number << "! = " << result << std::endl + << "Number of digits: " << result.num_digits() << std::endl + << "Time taken: " << std::scientific << time_taken << " s" + << std::endl; + + test1(); + test2(); + result.test(); + + return 0; +} diff --git a/math/large_number.h b/math/large_number.h new file mode 100644 index 000000000..c1a3665e4 --- /dev/null +++ b/math/large_number.h @@ -0,0 +1,287 @@ +/** + * @file + * @brief Library to perform arithmatic operations on arbitrarily large + * numbers. + */ + +#ifndef MATH_LARGE_NUMBER_H_ +#define MATH_LARGE_NUMBER_H_ +#include +#include +#include +#include +#include +#include +#include + +/** + * Store large unsigned numbers as a C++ vector + * The class provides convenience functions to add a + * digit to the number, perform multiplication of + * large number with long unsigned integers. + **/ +class large_number { + public: + /**< initializer with value = 1 */ + large_number() { _digits.push_back(1); } + + // /**< initializer from an integer */ + // explicit large_number(uint64_t n) { + // uint64_t carry = n; + // do { + // add_digit(carry % 10); + // carry /= 10; + // } while (carry != 0); + // } + + /**< initializer from an integer */ + explicit large_number(int n) { + int carry = n; + do { + add_digit(carry % 10); + carry /= 10; + } while (carry != 0); + } + + /**< initializer from another large_number */ + large_number(const large_number &a) : _digits(a._digits) {} + + /**< initializer from a vector */ + explicit large_number(std::vector &vec) : _digits(vec) {} + + /**< initializer from a string */ + explicit large_number(char const *number_str) { + for (size_t i = strlen(number_str); i > 0; i--) { + unsigned char a = number_str[i - 1] - '0'; + if (a >= 0 && a <= 9) + _digits.push_back(a); + } + } + + /** + * Function to check implementation + **/ + static bool test() { + std::cout << "------ Checking `large_number` class implementations\t" + << std::endl; + large_number a(40); + // 1. test multiplication + a *= 10; + if (a != large_number(400)) { + std::cerr << "\tFailed 1/6 (" << a << "!=400)" << std::endl; + return false; + } + std::cout << "\tPassed 1/6..."; + // 2. test compound addition with integer + a += 120; + if (a != large_number(520)) { + std::cerr << "\tFailed 2/6 (" << a << "!=520)" << std::endl; + return false; + } + std::cout << "\tPassed 2/6..."; + // 3. test compound multiplication again + a *= 10; + if (a != large_number(5200)) { + std::cerr << "\tFailed 3/6 (" << a << "!=5200)" << std::endl; + return false; + } + std::cout << "\tPassed 3/6..."; + // 4. test increment (prefix) + ++a; + if (a != large_number(5201)) { + std::cerr << "\tFailed 4/6 (" << a << "!=5201)" << std::endl; + return false; + } + std::cout << "\tPassed 4/6..."; + // 5. test increment (postfix) + a++; + if (a != large_number(5202)) { + std::cerr << "\tFailed 5/6 (" << a << "!=5202)" << std::endl; + return false; + } + std::cout << "\tPassed 5/6..."; + // 6. test addition with another large number + a = a + large_number("7000000000000000000000000000000"); + if (a != large_number("7000000000000000000000000005202")) { + std::cerr << "\tFailed 6/6 (" << a + << "!=7000000000000000000000000005202)" << std::endl; + return false; + } + std::cout << "\tPassed 6/6..." << std::endl; + return true; + } + + /** + * add a digit at MSB to the large number + **/ + void add_digit(unsigned int value) { + if (value > 9) { + std::cerr << "digit > 9!!\n"; + exit(EXIT_FAILURE); + } + + _digits.push_back(value); + } + + /** + * Get number of digits in the number + **/ + const size_t num_digits() const { return _digits.size(); } + + /** + * operator over load to access the + * i^th digit conveniently and also + * assign value to it + **/ + inline unsigned char &operator[](size_t n) { return this->_digits[n]; } + + inline const unsigned char &operator[](size_t n) const { + return this->_digits[n]; + } + + /** + * operator overload to compare two numbers + **/ + friend std::ostream &operator<<(std::ostream &out, const large_number &a) { + for (size_t i = a.num_digits(); i > 0; i--) + out << static_cast(a[i - 1]); + return out; + } + + /** + * operator overload to compare two numbers + **/ + friend bool operator==(large_number const &a, large_number const &b) { + size_t N = a.num_digits(); + if (N != b.num_digits()) + return false; + for (size_t i = 0; i < N; i++) + if (a[i] != b[i]) + return false; + return true; + } + + /** + * operator overload to compare two numbers + **/ + friend bool operator!=(large_number const &a, large_number const &b) { + return !(a == b); + } + + /** + * operator overload to increment (prefix) + **/ + large_number &operator++() { + (*this) += 1; + return *this; + } + + /** + * operator overload to increment (postfix) + **/ + large_number &operator++(int) { + static large_number tmp(_digits); + ++(*this); + return tmp; + } + + /** + * operator overload to add + **/ + large_number &operator+=(large_number n) { + // if adding with another large_number + large_number *b = reinterpret_cast(&n); + const size_t max_L = std::max(this->num_digits(), b->num_digits()); + unsigned int carry = 0; + size_t i; + for (i = 0; i < max_L || carry != 0; i++) { + if (i < b->num_digits()) + carry += (*b)[i]; + if (i < this->num_digits()) + carry += (*this)[i]; + if (i < this->num_digits()) + (*this)[i] = carry % 10; + else + this->add_digit(carry % 10); + carry /= 10; + } + return *this; + } + + large_number &operator+=(int n) { return (*this) += large_number(n); } + // large_number &operator+=(uint64_t n) { return (*this) += large_number(n); + // } + + /** + * operator overload to perform addition + **/ + template + friend large_number &operator+(const large_number &a, const T &b) { + static large_number c = a; + c += b; + return c; + } + + /** + * assignment operator + **/ + large_number &operator=(const large_number &b) { + this->_digits = b._digits; + return *this; + } + + /** + * operator overload to increment + **/ + template + large_number &operator*=(const T n) { + static_assert(std::is_integral::value, + "Must be integer addition unsigned integer types."); + this->multiply(n); + return *this; + } + + /** + * returns i^th digit as an ASCII character + **/ + const char digit_char(size_t i) const { + return _digits[num_digits() - i - 1] + '0'; + } + + private: + /** + * multiply large number with another integer and + * store the result in the same large number + **/ + template + void multiply(const T n) { + static_assert(std::is_integral::value, + "Can only have integer types."); + // assert(!(std::is_signed::value)); //, "Implemented only for + // unsigned integer types."); + + size_t i; + uint64_t carry = 0, temp; + for (i = 0; i < this->num_digits(); i++) { + temp = (*this)[i] * n; + temp += carry; + if (temp < 10) { + carry = 0; + } else { + carry = temp / 10; + temp = temp % 10; + } + (*this)[i] = temp; + } + + while (carry != 0) { + this->add_digit(carry % 10); + carry /= 10; + } + } + + std::vector + _digits; /**< where individual digits are stored */ +}; + +#endif // MATH_LARGE_NUMBER_H_ diff --git a/math/modular_inverse_fermat_little_theorem.cpp b/math/modular_inverse_fermat_little_theorem.cpp index 965c21298..7550e14bf 100644 --- a/math/modular_inverse_fermat_little_theorem.cpp +++ b/math/modular_inverse_fermat_little_theorem.cpp @@ -1,44 +1,59 @@ -/* - * C++ Program to find the modular inverse using Fermat's Little Theorem. - * Fermat's Little Theorem state that => ϕ(m) = m-1, where m is a prime number. - * - * (a * x) ≡ 1 mod m. - * x ≡ (a^(-1)) mod m. +/** + * @file + * @brief C++ Program to find the modular inverse using [Fermat's Little + * Theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) * + * Fermat's Little Theorem state that \f[ϕ(m) = m-1\f] + * where \f$m\f$ is a prime number. + * \f{eqnarray*}{ + * a \cdot x &≡& 1 \;\text{mod}\; m\\ + * x &≡& a^{-1} \;\text{mod}\; m + * \f} * Using Euler's theorem we can modify the equation. + *\f[ + * a^{ϕ(m)} ≡ 1 \;\text{mod}\; m + * \f] + * (Where '^' denotes the exponent operator) * - * (a^ϕ(m)) ≡ 1 mod m (Where '^' denotes the exponent operator) - * Here 'ϕ' is Euler's Totient Function. For modular inverse existence 'a' and 'm' must be relatively primes numbers. - * To apply Fermat's Little Theorem is necessary that 'm' must be a prime number. - * Generally in many competitive programming competitions 'm' is either 1000000007 (1e9+7) or 998244353. + * Here 'ϕ' is Euler's Totient Function. For modular inverse existence 'a' and + * 'm' must be relatively primes numbers. To apply Fermat's Little Theorem is + * necessary that 'm' must be a prime number. Generally in many competitive + * programming competitions 'm' is either 1000000007 (1e9+7) or 998244353. * * We considered m as large prime (1e9+7). - * (a^ϕ(m)) ≡ 1 mod m (Using Euler's Theorem) - * ϕ(m) = m-1 using Fermat's Little Theorem. - * (a^(m-1)) ≡ 1 mod m - * Now multiplying both side by (a^(-1)). - * (a^(m-1)) * (a^(-1)) ≡ (a^(-1)) mod m - * (a^(m-2)) ≡ (a^(-1)) mod m + * \f$a^{ϕ(m)} ≡ 1 \;\text{mod}\; m\f$ (Using Euler's Theorem) + * \f$ϕ(m) = m-1\f$ using Fermat's Little Theorem. + * \f$a^{m-1} ≡ 1 \;\text{mod}\; m\f$ + * Now multiplying both side by \f$a^{-1}\f$. + * \f{eqnarray*}{ + * a^{m-1} \cdot a^{-1} &≡& a^{-1} \;\text{mod}\; m\\ + * a^{m-2} &≡& a^{-1} \;\text{mod}\; m + * \f} * - * We will find the exponent using binary exponentiation. Such that the algorithm works in O(log(m)) time. + * We will find the exponent using binary exponentiation. Such that the + * algorithm works in \f$O(\log m)\f$ time. * - * Example: - - * a = 3 and m = 7 - * (a^(-1) mod m) is equivalent to (a^(m-2) mod m) - * (3^(5) mod 7) = (243 mod 7) = 5 - * Hence, ( 3^(-1) mod 7 ) = 5 - * or ( 3 * 5 ) mod 7 = 1 mod 7 (as a*(a^(-1)) = 1) + * Examples: - + * * a = 3 and m = 7 + * * \f$a^{-1} \;\text{mod}\; m\f$ is equivalent to + * \f$a^{m-2} \;\text{mod}\; m\f$ + * * \f$3^5 \;\text{mod}\; 7 = 243 \;\text{mod}\; 7 = 5\f$ + *
Hence, \f$3^{-1} \;\text{mod}\; 7 = 5\f$ + * or \f$3 \times 5 \;\text{mod}\; 7 = 1 \;\text{mod}\; 7\f$ + * (as \f$a\times a^{-1} = 1\f$) */ -#include -#include +#include +#include -// Recursive function to calculate exponent in O(log(n)) using binary exponent. +/** Recursive function to calculate exponent in \f$O(\log n)\f$ using binary + * exponent. + */ int64_t binExpo(int64_t a, int64_t b, int64_t m) { a %= m; int64_t res = 1; while (b > 0) { - if (b%2) { + if (b % 2) { res = res * a % m; } a = a * a % m; @@ -48,13 +63,14 @@ int64_t binExpo(int64_t a, int64_t b, int64_t m) { return res; } -// Prime check in O(sqrt(m)) time. +/** Prime check in \f$O(\sqrt{m})\f$ time. + */ bool isPrime(int64_t m) { if (m <= 1) { return false; } else { - for (int i=2; i*i <= m; i++) { - if (m%i == 0) { + for (int64_t i = 2; i * i <= m; i++) { + if (m % i == 0) { return false; } } @@ -62,6 +78,9 @@ bool isPrime(int64_t m) { return true; } +/** + * Main function + */ int main() { int64_t a, m; // Take input of a and m. @@ -71,7 +90,7 @@ int main() { std::cin >> a >> m; if (isPrime(m)) { std::cout << "The modular inverse of a with mod m is (a^(m-2)) : "; - std::cout << binExpo(a, m-2, m) << std::endl; + std::cout << binExpo(a, m - 2, m) << std::endl; } else { std::cout << "m must be a prime number."; std::cout << std::endl; diff --git a/math/number_of_positive_divisors.cpp b/math/number_of_positive_divisors.cpp index 48ab63c36..f157f7b41 100644 --- a/math/number_of_positive_divisors.cpp +++ b/math/number_of_positive_divisors.cpp @@ -1,34 +1,39 @@ -/// C++ Program to calculate number of divisors. - -#include -#include - /** + * @file + * @brief C++ Program to calculate number of divisors + * * This algorithm use the prime factorization approach. * Any number can be written in multiplication of its prime factors. - * Let N = P1^E1 * P2^E2 ... Pk^Ek - * Therefore. number-of-divisors(N) = (E1+1) * (E2+1) ... (Ek+1). - * Where P1, P2 ... Pk are prime factors and E1, E2 ... Ek are exponents respectively. + *
Let N = P1^E1 * P2^E2 ... Pk^Ek + *
Therefore. number-of-divisors(N) = (E1+1) * (E2+1) ... (Ek+1). + *
Where P1, P2 ... Pk are prime factors and E1, E2 ... Ek are exponents +respectively. * * Example:- - * N = 36 - * 36 = (3^2 * 2^2) - * number_of_positive_divisors(36) = (2+1) * (2+1) = 9. - * list of positive divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36. + *
N = 36 + *
36 = (3^2 * 2^2) + *
number_of_positive_divisors(36) = (2+1) * (2+1) = 9. + *
list of positive divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36. * * Similarly if N is -36 at that time number of positive divisors remain same. * * Example:- - * N = -36 - * -36 = -1 * (3^2 * 2^2) - * number_of_positive_divisors(-36) = (2+1) * (2+1) = 9. - * list of positive divisors of -36 = 1, 2, 3, 4, 6, 9, 12, 18, 36. + *
N = -36 + *
-36 = -1 * (3^2 * 2^2) + *
number_of_positive_divisors(-36) = (2+1) * (2+1) = 9. + *
list of positive divisors of -36 = 1, 2, 3, 4, 6, 9, 12, 18, 36. * **/ +#include +#include + +/** + * Algorithm + */ int number_of_positive_divisors(int n) { std::vector prime_exponent_count; - for (int i=2; i*i <= n; i++) { + for (int i = 2; i * i <= n; i++) { int prime_count = 0; while (n % i == 0) { prime_count += 1; @@ -44,13 +49,16 @@ int number_of_positive_divisors(int n) { int divisors_count = 1; - for (int i=0; i < prime_exponent_count.size(); i++) { - divisors_count = divisors_count * (prime_exponent_count[i]+1); + for (int i = 0; i < prime_exponent_count.size(); i++) { + divisors_count = divisors_count * (prime_exponent_count[i] + 1); } return divisors_count; } +/** + * Main function + */ int main() { int n; std::cin >> n; diff --git a/math/power_for_huge_numbers.cpp b/math/power_for_huge_numbers.cpp index bf9374228..301767d66 100644 --- a/math/power_for_huge_numbers.cpp +++ b/math/power_for_huge_numbers.cpp @@ -1,91 +1,90 @@ +/** + * @file + * @brief Compute powers of large numbers + */ #include -using namespace std; -// Maximum number of digits in output -// x^n where 1 <= x, n <= 10000 and overflow may happen +/** Maximum number of digits in output + * \f$x^n\f$ where \f$1 <= x,\; n <= 10000\f$ and overflow may happen + */ #define MAX 100000 -// This function multiplies x -// with the number represented by res[]. -// res_size is size of res[] or -// number of digits in the number -// represented by res[]. This function -// uses simple school mathematics -// for multiplication. -// This function may value of res_size -// and returns the new value of res_size -int multiply(int x, int res[], int res_size) -{ +/** This function multiplies x + * with the number represented by res[]. + * res_size is size of res[] or + * number of digits in the number + * represented by res[]. This function + * uses simple school mathematics + * for multiplication. + * This function may value of res_size + * and returns the new value of res_size + * @param x multiplicand + * @param res large number representation using array + * @param res_size number of digits in `res` + */ +int multiply(int x, int res[], int res_size) { + // Initialize carry + int carry = 0; - // Initialize carry - int carry = 0; + // One by one multiply n with + // individual digits of res[] + for (int i = 0; i < res_size; i++) { + int prod = res[i] * x + carry; - // One by one multiply n with - // individual digits of res[] - for (int i = 0; i < res_size; i++) - { - int prod = res[i] * x + carry; + // Store last digit of + // 'prod' in res[] + res[i] = prod % 10; - // Store last digit of - // 'prod' in res[] - res[i] = prod % 10; + // Put rest in carry + carry = prod / 10; + } - // Put rest in carry - carry = prod / 10; - } - - // Put carry in res and - // increase result size - while (carry) - { - res[res_size] = carry % 10; - carry = carry / 10; - res_size++; - } - return res_size; + // Put carry in res and + // increase result size + while (carry) { + res[res_size] = carry % 10; + carry = carry / 10; + res_size++; + } + return res_size; } -// This function finds -// power of a number x -void power(int x, int n) -{ +/** This function finds power of a number x and print \f$x^n\f$ + * @param x base + * @param n exponent + */ +void power(int x, int n) { + // printing value "1" for power = 0 + if (n == 0) { + std::cout << "1"; + return; + } - //printing value "1" for power = 0 - if (n == 0) - { - cout << "1"; - return; - } + int res[MAX]; + int res_size = 0; + int temp = x; - int res[MAX]; - int res_size = 0; - int temp = x; + // Initialize result + while (temp != 0) { + res[res_size++] = temp % 10; + temp = temp / 10; + } - // Initialize result - while (temp != 0) - { - res[res_size++] = temp % 10; - temp = temp / 10; - } + // Multiply x n times + // (x^n = x*x*x....n times) + for (int i = 2; i <= n; i++) res_size = multiply(x, res, res_size); - // Multiply x n times - // (x^n = x*x*x....n times) - for (int i = 2; i <= n; i++) - res_size = multiply(x, res, res_size); - - cout << x << "^" << n << " = "; - for (int i = res_size - 1; i >= 0; i--) - cout << res[i]; + std::cout << x << "^" << n << " = "; + for (int i = res_size - 1; i >= 0; i--) std::cout << res[i]; } -// Driver program -int main() -{ - int exponent, base; - printf("Enter base "); - scanf("%id \n", &base); - printf("Enter exponent "); - scanf("%id", &exponent); - power(base, exponent); - return 0; +/** Main function */ +int main() { + int exponent, base; + std::cout << "Enter base "; + std::cin >> base; + std::cout << "Enter exponent "; + std::cin >> exponent; + power(base, exponent); + return 0; } diff --git a/math/prime_factorization.cpp b/math/prime_factorization.cpp index 822cad332..001c2c3c3 100644 --- a/math/prime_factorization.cpp +++ b/math/prime_factorization.cpp @@ -1,80 +1,77 @@ +/** + * @file + * @brief Prime factorization of positive integers + */ +#include +#include #include #include -#include -using namespace std; -// Declaring variables for maintaing prime numbers and to check whether a number is prime or not +/** Declaring variables for maintaing prime numbers and to check whether a + * number is prime or not + */ bool isprime[1000006]; -vector prime_numbers; -vector> factors; -// Calculating prime number upto a given range -void SieveOfEratosthenes(int N) -{ +/** list of prime numbers */ +std::vector prime_numbers; + +/** list of prime factor-pairs */ +std::vector> factors; + +/** Calculating prime number upto a given range + */ +void SieveOfEratosthenes(int N) { // initializes the array isprime memset(isprime, true, sizeof isprime); - for (int i = 2; i <= N; i++) - { - if (isprime[i]) - { - for (int j = 2 * i; j <= N; j += i) - isprime[j] = false; + for (int i = 2; i <= N; i++) { + if (isprime[i]) { + for (int j = 2 * i; j <= N; j += i) isprime[j] = false; } } - for (int i = 2; i <= N; i++) - { + for (int i = 2; i <= N; i++) { if (isprime[i]) prime_numbers.push_back(i); } } -// Prime factorization of a number -void prime_factorization(int num) -{ - +/** Prime factorization of a number */ +void prime_factorization(int num) { int number = num; - for (int i = 0; prime_numbers[i] <= num; i++) - { + for (int i = 0; prime_numbers[i] <= num; i++) { int count = 0; // termination condition - if (number == 1) - { + if (number == 1) { break; } - while (number % prime_numbers[i] == 0) - { + while (number % prime_numbers[i] == 0) { count++; number = number / prime_numbers[i]; } if (count) - factors.push_back(make_pair(prime_numbers[i], count)); + factors.push_back(std::make_pair(prime_numbers[i], count)); } } -/* - I added a simple UI. -*/ -int main() -{ +/** Main program */ +int main() { int num; - cout << "\t\tComputes the prime factorization\n\n"; - cout << "Type in a number: "; - cin >> num; + std::cout << "\t\tComputes the prime factorization\n\n"; + std::cout << "Type in a number: "; + std::cin >> num; SieveOfEratosthenes(num); prime_factorization(num); // Prime factors with their powers in the given number in new line - for (auto it : factors) - { - cout << it.first << " " << it.second << endl; + for (auto it : factors) { + std::cout << it.first << " " << it.second << std::endl; } return 0; diff --git a/math/prime_numbers.cpp b/math/prime_numbers.cpp index 7264ff528..4dd54f136 100644 --- a/math/prime_numbers.cpp +++ b/math/prime_numbers.cpp @@ -1,26 +1,33 @@ +/** + * @file + * @brief Get list of prime numbers + * @see primes_up_to_billion.cpp sieve_of_eratosthenes.cpp + */ #include #include +/** Generate an increasingly large number of primes + * and store in a list + */ std::vector primes(int max) { max++; std::vector res; std::vector numbers(max, false); for (int i = 2; i < max; i++) { if (!numbers[i]) { - for (int j = i; j < max; j += i) - numbers[j] = true; + for (int j = i; j < max; j += i) numbers[j] = true; res.push_back(i); } } return res; } +/** main function */ int main() { std::cout << "Calculate primes up to:\n>> "; int n; std::cin >> n; std::vector ans = primes(n); - for (int i = 0; i < ans.size(); i++) - std::cout << ans[i] << ' '; + for (int i = 0; i < ans.size(); i++) std::cout << ans[i] << ' '; std::cout << std::endl; } diff --git a/math/primes_up_to_10^8.cpp b/math/primes_up_to_billion.cpp similarity index 59% rename from math/primes_up_to_10^8.cpp rename to math/primes_up_to_billion.cpp index db9b56cab..4fb79a15e 100644 --- a/math/primes_up_to_10^8.cpp +++ b/math/primes_up_to_billion.cpp @@ -1,12 +1,19 @@ -#include +/** + * @file + * @brief Compute prime numbers upto 1 billion + * @see prime_numbers.cpp sieve_of_eratosthenes.cpp + */ #include +#include +/** array to store the primes */ char prime[100000000]; +/** Perform Sieve algorithm */ void Sieve(int64_t n) { memset(prime, '1', sizeof(prime)); // intitize '1' to every index - prime[0] = '0'; // 0 is not prime - prime[1] = '0'; // 1 is not prime + prime[0] = '0'; // 0 is not prime + prime[1] = '0'; // 1 is not prime for (int p = 2; p * p <= n; p++) { if (prime[p] == '1') { for (int i = p * p; i <= n; i += p) @@ -15,7 +22,7 @@ void Sieve(int64_t n) { } } - +/** Main function */ int main() { Sieve(100000000); int64_t n; @@ -24,4 +31,6 @@ int main() { std::cout << "YES\n"; else std::cout << "NO\n"; + + return 0; } diff --git a/math/sieve_of_eratosthenes.cpp b/math/sieve_of_eratosthenes.cpp index e600e480d..d8fa70531 100644 --- a/math/sieve_of_eratosthenes.cpp +++ b/math/sieve_of_eratosthenes.cpp @@ -1,69 +1,65 @@ -/* - * Sieve of Eratosthenes is an algorithm to find the primes +/** + * @file + * @brief Get list of prime numbers using Sieve of Eratosthenes + * Sieve of Eratosthenes is an algorithm to find the primes * that is between 2 to N (as defined in main). * - * Time Complexity : O(N * log N) - * Space Complexity : O(N) + * Time Complexity : \f$O(N \cdot\log N)\f$ + *
Space Complexity : \f$O(N)\f$ + * + * @see primes_up_to_billion.cpp prime_numbers.cpp */ #include -using namespace std; +/** Maximum number of primes */ #define MAX 10000000 -int isprime[MAX]; +/** array to store the primes */ +bool isprime[MAX]; -/* - * This is the function that finds the primes and eliminates +/** + * This is the function that finds the primes and eliminates * the multiples. */ -void sieve(int N) -{ - isprime[0] = 0; - isprime[1] = 0; - for (int i = 2; i <= N; i++) - { - if (isprime[i]) - { - for (int j = i * 2; j <= N; j += i) - { - isprime[j] = 0; +void sieve(uint32_t N) { + isprime[0] = false; + isprime[1] = false; + for (uint32_t i = 2; i <= N; i++) { + if (isprime[i]) { + for (uint32_t j = (i << 1); j <= N; j += i) { + isprime[j] = false; } } } } -/* +/** * This function prints out the primes to STDOUT */ -void print(int N) -{ - for (int i = 1; i <= N; i++) - { - if (isprime[i] == 1) - { - cout << i << ' '; +void print(uint32_t N) { + for (uint32_t i = 1; i <= N; i++) { + if (isprime[i]) { + std::cout << i << ' '; } } - cout << '\n'; + std::cout << std::endl; } -/* - * NOTE: This function is important for the - * initialization of the array. +/** + * Initialize the array */ -void init() -{ - for (int i = 1; i < MAX; i++) - { - isprime[i] = 1; +void init() { + for (uint32_t i = 1; i < MAX; i++) { + isprime[i] = true; } } -int main() -{ - int N = 100; +/** main function */ +int main() { + uint32_t N = 100; init(); sieve(N); print(N); + return 0; } diff --git a/math/sqrt_double.cpp b/math/sqrt_double.cpp index 5a0fd1c88..1521b500a 100644 --- a/math/sqrt_double.cpp +++ b/math/sqrt_double.cpp @@ -1,27 +1,35 @@ -#include +/** + * @file + * @brief Calculate the square root of any positive number in \f$O(\log N)\f$ + * time, with precision fixed using [bisection + * method](https://en.wikipedia.org/wiki/Bisection_method) of root-finding. + * + * @see Can be implemented using faster and better algorithms like + * newton_raphson_method.cpp and false_position.cpp + */ #include +#include -/* Calculate the square root of any -number in O(logn) time, -with precision fixed */ - -double Sqrt(double x) { - if ( x > 0 && x < 1 ) { - return 1/Sqrt(1/x); +/** Bisection method implemented for the function \f$x^2-a=0\f$ + * whose roots are \f$\pm\sqrt{a}\f$ and only the positive root is returned. + */ +double Sqrt(double a) { + if (a > 0 && a < 1) { + return 1 / Sqrt(1 / a); } - double l = 0, r = x; - /* Epsilon is the precision. - A great precision is + double l = 0, r = a; + /* Epsilon is the precision. + A great precision is between 1e-7 and 1e-12. double epsilon = 1e-12; */ double epsilon = 1e-12; - while ( l <= r ) { + while (l <= r) { double mid = (l + r) / 2; - if ( mid * mid > x ) { + if (mid * mid > a) { r = mid; } else { - if ( x - mid * mid < epsilon ) { + if (a - mid * mid < epsilon) { return mid; } l = mid; @@ -29,11 +37,13 @@ double Sqrt(double x) { } return -1; } + +/** main function */ int main() { - double n{}; - std::cin >> n; - assert(n >= 0); - // Change this line for a better precision - std::cout.precision(12); - std::cout << std::fixed << Sqrt(n); + double n{}; + std::cin >> n; + assert(n >= 0); + // Change this line for a better precision + std::cout.precision(12); + std::cout << std::fixed << Sqrt(n); } diff --git a/math/string_fibonacci.cpp b/math/string_fibonacci.cpp new file mode 100644 index 000000000..eb9b6d7e1 --- /dev/null +++ b/math/string_fibonacci.cpp @@ -0,0 +1,89 @@ +/** + * @file + * @brief This Programme returns the Nth fibonacci as a string. + * + * The method used is manual addition with carry and placing it in a string + * which is called string addition This makes it have no bounds or limits + * + * @see fibonacci_large.cpp, fibonacci_fast.cpp, fibonacci.cpp + */ + +#include +#ifdef _MSC_VER +#include // use this for MS Visual C +#else +#include // otherwise +#endif + +/** + * function to add two string numbers + * \param [in] a first number in string to add + * \param [in] b second number in string to add + * \returns sum as a std::string + */ +std::string add(std::string a, std::string b) { + std::string temp = ""; + + // carry flag + int carry = 0; + + // fills up with zeros + while (a.length() < b.length()) { + a = "0" + a; + } + + // fills up with zeros + while (b.length() < a.length()) { + b = "0" + b; + } + + // adds the numbers a and b + for (int i = a.length() - 1; i >= 0; i--) { + char val = static_cast(((a[i] - 48) + (b[i] - 48)) + 48 + carry); + if (val > 57) { + carry = 1; + val -= 10; + } else { + carry = 0; + } + temp = val + temp; + } + + // processes the carry flag + if (carry == 1) { + temp = "1" + temp; + } + + // removes leading zeros. + while (temp[0] == '0' && temp.length() > 1) { + temp = temp.substr(1); + } + + return temp; +} + +/** Fibonacci iterator + * \param [in] n n^th Fibonacci number + */ +void fib_Accurate(uint64_t n) { + std::string tmp = ""; + std::string fibMinus1 = "1"; + std::string fibMinus2 = "0"; + for (uint64_t i = 0; i < n; i++) { + tmp = add(fibMinus1, fibMinus2); + fibMinus2 = fibMinus1; + fibMinus1 = tmp; + } + std::cout << fibMinus2; +} + +/** main function */ +int main() { + int n; + std::cout << "Enter whatever number N you want to find the fibonacci of\n"; + std::cin >> n; + std::cout << n << " th Fibonacci is \n"; + fib_Accurate(n); + + return 0; +} diff --git a/operations_on_datastructures/Array Left Rotation.cpp b/operations_on_datastructures/Array Left Rotation.cpp deleted file mode 100644 index 9eb5d4e50..000000000 --- a/operations_on_datastructures/Array Left Rotation.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -using namespace std; -int main() -{ - int n, k; - cout << "Enter size of array=\t"; - cin >> n; - cout << "Enter Number of indeces u want to rotate the array to left=\t"; - cin >> k; - int a[n]; - cout << "Enter elements of array=\t"; - for (int i = 0; i < n; i++) - { - cin >> a[i]; - } - int temp = 0; - for (int i = 0; i < k; i++) - { - temp = a[0]; - for (int j = 0; j < n; j++) - { - if (j == n - 1) - { - a[n - 1] = temp; - } - else - { - a[j] = a[j + 1]; - } - } - } - cout << "Your rotated array is=\t"; - for (int j = 0; j < n; j++) - { - cout << a[j] << " "; - } - getchar(); - return 0; -} diff --git a/operations_on_datastructures/Circular Linked List.cpp b/operations_on_datastructures/Circular Linked List.cpp deleted file mode 100644 index d360f6cd7..000000000 --- a/operations_on_datastructures/Circular Linked List.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include -using namespace std; - -struct node -{ - int val; - node *next; -}; - -node *start; - -void insert(int x) -{ - node *t = start; - - if (start != NULL) - { - while (t->next != start) - { - t = t->next; - } - node *n = new node; - t->next = n; - n->val = x; - n->next = start; - } - else - { - node *n = new node; - n->val = x; - start = n; - n->next = start; - } -} - -void remove(int x) -{ - node *t = start; - node *p; - while (t->val != x) - { - p = t; - t = t->next; - } - p->next = t->next; - delete t; -} - -void search(int x) -{ - node *t = start; - int found = 0; - while (t->next != start) - { - if (t->val == x) - { - cout << "\nFound"; - found = 1; - break; - } - t = t->next; - } - if (found == 0) - { - cout << "\nNot Found"; - } -} - -void show() -{ - node *t = start; - do - { - cout << t->val << "\t"; - t = t->next; - } while (t != start); -} - -int main() -{ - int choice, x; - do - { - cout << "\n1. Insert"; - cout << "\n2. Delete"; - cout << "\n3. Search"; - cout << "\n4. Print"; - cout << "\n\nEnter you choice : "; - cin >> choice; - switch (choice) - { - case 1: - cout << "\nEnter the element to be inserted : "; - cin >> x; - insert(x); - break; - case 2: - cout << "\nEnter the element to be removed : "; - cin >> x; - remove(x); - break; - case 3: - cout << "\nEnter the element to be searched : "; - cin >> x; - search(x); - break; - case 4: - show(); - break; - } - } while (choice != 0); - - return 0; -} diff --git a/operations_on_datastructures/Circular Queue Using Array.cpp b/operations_on_datastructures/Circular Queue Using Array.cpp deleted file mode 100644 index 36d7e22c3..000000000 --- a/operations_on_datastructures/Circular Queue Using Array.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include -using namespace std; - -int queue[10]; -int front = 0; -int rear = 0; -int count = 0; - -void Enque(int x) -{ - if (count == 10) - { - cout << "\nOverflow"; - } - else - { - queue[rear] = x; - rear = (rear + 1) % 10; - count++; - } -} - -void Deque() -{ - if (front == rear) - { - cout << "\nUnderflow"; - } - - else - { - cout << "\n" - << queue[front] << " deleted"; - front = (front + 1) % 10; - count--; - } -} - -void show() -{ - for (int i = 0; i < count; i++) - { - cout << queue[(i + front) % 10] << "\t"; - } -} - -int main() -{ - int ch, x; - do - { - cout << "\n1. Enque"; - cout << "\n2. Deque"; - cout << "\n3. Print"; - cout << "\nEnter Your Choice : "; - cin >> ch; - if (ch == 1) - { - cout << "\nInsert : "; - cin >> x; - Enque(x); - } - else if (ch == 2) - { - Deque(); - } - else if (ch == 3) - { - show(); - } - } while (ch != 0); - - return 0; -} diff --git a/operations_on_datastructures/Intersection_of_2_arrays.cpp b/operations_on_datastructures/Intersection_of_2_arrays.cpp deleted file mode 100644 index 05652811f..000000000 --- a/operations_on_datastructures/Intersection_of_2_arrays.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -int main() -{ - int i, j, m, n; - cout << "Enter size of array 1:"; - cin >> m; - cout << "Enter size of array 2:"; - cin >> n; - int a[m]; - int b[n]; - cout << "Enter elements of array 1:"; - for (i = 0; i < m; i++) - cin >> a[i]; - for (i = 0; i < n; i++) - cin >> b[i]; - i = 0; - j = 0; - while ((i < m) && (j < n)) - { - if (a[i] < b[j]) - i++; - else if (a[i] > b[j]) - j++; - else - { - cout << a[i++] << " "; - j++; - } - } - return 0; -} diff --git a/operations_on_datastructures/Reverse a Linked List using Recusion.cpp b/operations_on_datastructures/Reverse a Linked List using Recusion.cpp deleted file mode 100644 index 0908080cc..000000000 --- a/operations_on_datastructures/Reverse a Linked List using Recusion.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include -using namespace std; - -struct node -{ - int val; - node *next; -}; - -node *start; - -void insert(int x) -{ - node *t = start; - if (start != NULL) - { - while (t->next != NULL) - { - t = t->next; - } - node *n = new node; - t->next = n; - n->val = x; - n->next = NULL; - } - else - { - node *n = new node; - n->val = x; - n->next = NULL; - start = n; - } -} - -void reverse(node *p, node *q) -{ - if (q->next == NULL) - { - q->next = p; - p->next = NULL; - start = q; - return; - } - else - { - reverse(q, q->next); - q->next = p; - p->next = NULL; - } -} - -void show() -{ - node *t = start; - while (t != NULL) - { - cout << t->val << "\t"; - t = t->next; - } -} - -int main() -{ - insert(1); - insert(2); - insert(3); - insert(4); - insert(5); - insert(6); - - reverse(start, start->next); - - show(); - - return 0; -} diff --git a/operations_on_datastructures/Union_of_2_arrays.cpp b/operations_on_datastructures/Union_of_2_arrays.cpp deleted file mode 100644 index aaaeb8378..000000000 --- a/operations_on_datastructures/Union_of_2_arrays.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -int main() -{ - int m, n, i = 0, j = 0; - cout << "Enter size of both arrays:"; - cin >> m >> n; - int a[m]; - int b[n]; - cout << "Enter elements of array 1:"; - for (i = 0; i < m; i++) - cin >> a[i]; - cout << "Enter elements of array 2:"; - for (i = 0; i < n; i++) - cin >> b[i]; - i = 0; - j = 0; - while ((i < m) && (j < n)) - { - if (a[i] < b[j]) - cout << a[i++] << " "; - else if (a[i] > b[j]) - cout << b[j++] << " "; - else - { - cout << a[i++]; - j++; - } - } - while (i < m) - cout << a[i++] << " "; - while (j < n) - cout << b[j++] << " "; - return 0; -} diff --git a/operations_on_datastructures/array_left_rotation.cpp b/operations_on_datastructures/array_left_rotation.cpp new file mode 100644 index 000000000..7b8f7f279 --- /dev/null +++ b/operations_on_datastructures/array_left_rotation.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +int main() { + int n, k; + cout << "Enter size of array=\t"; + cin >> n; + cout << "Enter Number of indeces u want to rotate the array to left=\t"; + cin >> k; + int a[n]; + cout << "Enter elements of array=\t"; + for (int i = 0; i < n; i++) { + cin >> a[i]; + } + int temp = 0; + for (int i = 0; i < k; i++) { + temp = a[0]; + for (int j = 0; j < n; j++) { + if (j == n - 1) { + a[n - 1] = temp; + } else { + a[j] = a[j + 1]; + } + } + } + cout << "Your rotated array is=\t"; + for (int j = 0; j < n; j++) { + cout << a[j] << " "; + } + getchar(); + return 0; +} diff --git a/operations_on_datastructures/Array Right Rotation.cpp b/operations_on_datastructures/array_right_rotation.cpp similarity index 62% rename from operations_on_datastructures/Array Right Rotation.cpp rename to operations_on_datastructures/array_right_rotation.cpp index 81875766c..8b01a2003 100644 --- a/operations_on_datastructures/Array Right Rotation.cpp +++ b/operations_on_datastructures/array_right_rotation.cpp @@ -1,7 +1,6 @@ #include using namespace std; -int main() -{ +int main() { int n, k; cout << "Enter size of array=\t"; cin >> n; @@ -9,27 +8,20 @@ int main() cin >> k; int a[n]; cout << "Enter elements of array=\t"; - for (int i = 0; i < n; i++) - cin >> a[i]; + for (int i = 0; i < n; i++) cin >> a[i]; int temp = 0; - for (int i = 0; i < k; i++) - { + for (int i = 0; i < k; i++) { temp = a[n - 1]; - for (int j = n - 1; j >= 0; j--) - { - if (j == 0) - { + for (int j = n - 1; j >= 0; j--) { + if (j == 0) { a[j] = temp; - } - else - { + } else { a[j] = a[j - 1]; } } } cout << "Your rotated array is=\t"; - for (int i = 0; i < n; i++) - { + for (int i = 0; i < n; i++) { cout << a[i] << " "; } } diff --git a/operations_on_datastructures/circular_linked_list.cpp b/operations_on_datastructures/circular_linked_list.cpp new file mode 100644 index 000000000..1119bb5e7 --- /dev/null +++ b/operations_on_datastructures/circular_linked_list.cpp @@ -0,0 +1,97 @@ +#include +using namespace std; + +struct node { + int val; + node *next; +}; + +node *start; + +void insert(int x) { + node *t = start; + + if (start != NULL) { + while (t->next != start) { + t = t->next; + } + node *n = new node; + t->next = n; + n->val = x; + n->next = start; + } else { + node *n = new node; + n->val = x; + start = n; + n->next = start; + } +} + +void remove(int x) { + node *t = start; + node *p; + while (t->val != x) { + p = t; + t = t->next; + } + p->next = t->next; + delete t; +} + +void search(int x) { + node *t = start; + int found = 0; + while (t->next != start) { + if (t->val == x) { + cout << "\nFound"; + found = 1; + break; + } + t = t->next; + } + if (found == 0) { + cout << "\nNot Found"; + } +} + +void show() { + node *t = start; + do { + cout << t->val << "\t"; + t = t->next; + } while (t != start); +} + +int main() { + int choice, x; + do { + cout << "\n1. Insert"; + cout << "\n2. Delete"; + cout << "\n3. Search"; + cout << "\n4. Print"; + cout << "\n\nEnter you choice : "; + cin >> choice; + switch (choice) { + case 1: + cout << "\nEnter the element to be inserted : "; + cin >> x; + insert(x); + break; + case 2: + cout << "\nEnter the element to be removed : "; + cin >> x; + remove(x); + break; + case 3: + cout << "\nEnter the element to be searched : "; + cin >> x; + search(x); + break; + case 4: + show(); + break; + } + } while (choice != 0); + + return 0; +} diff --git a/operations_on_datastructures/circular_queue_using_array.cpp b/operations_on_datastructures/circular_queue_using_array.cpp new file mode 100644 index 000000000..e0e049611 --- /dev/null +++ b/operations_on_datastructures/circular_queue_using_array.cpp @@ -0,0 +1,57 @@ +#include +using namespace std; + +int queue[10]; +int front = 0; +int rear = 0; +int count = 0; + +void Enque(int x) { + if (count == 10) { + cout << "\nOverflow"; + } else { + queue[rear] = x; + rear = (rear + 1) % 10; + count++; + } +} + +void Deque() { + if (front == rear) { + cout << "\nUnderflow"; + } + + else { + cout << "\n" << queue[front] << " deleted"; + front = (front + 1) % 10; + count--; + } +} + +void show() { + for (int i = 0; i < count; i++) { + cout << queue[(i + front) % 10] << "\t"; + } +} + +int main() { + int ch, x; + do { + cout << "\n1. Enque"; + cout << "\n2. Deque"; + cout << "\n3. Print"; + cout << "\nEnter Your Choice : "; + cin >> ch; + if (ch == 1) { + cout << "\nInsert : "; + cin >> x; + Enque(x); + } else if (ch == 2) { + Deque(); + } else if (ch == 3) { + show(); + } + } while (ch != 0); + + return 0; +} diff --git a/operations_on_datastructures/intersection_of_2_arrays.cpp b/operations_on_datastructures/intersection_of_2_arrays.cpp new file mode 100644 index 000000000..8a3b27edf --- /dev/null +++ b/operations_on_datastructures/intersection_of_2_arrays.cpp @@ -0,0 +1,26 @@ +#include +int main() { + int i, j, m, n; + cout << "Enter size of array 1:"; + cin >> m; + cout << "Enter size of array 2:"; + cin >> n; + int a[m]; + int b[n]; + cout << "Enter elements of array 1:"; + for (i = 0; i < m; i++) cin >> a[i]; + for (i = 0; i < n; i++) cin >> b[i]; + i = 0; + j = 0; + while ((i < m) && (j < n)) { + if (a[i] < b[j]) + i++; + else if (a[i] > b[j]) + j++; + else { + cout << a[i++] << " "; + j++; + } + } + return 0; +} diff --git a/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp b/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp new file mode 100644 index 000000000..b9540d951 --- /dev/null +++ b/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp @@ -0,0 +1,63 @@ +#include +using namespace std; + +struct node { + int val; + node *next; +}; + +node *start; + +void insert(int x) { + node *t = start; + if (start != NULL) { + while (t->next != NULL) { + t = t->next; + } + node *n = new node; + t->next = n; + n->val = x; + n->next = NULL; + } else { + node *n = new node; + n->val = x; + n->next = NULL; + start = n; + } +} + +void reverse(node *p, node *q) { + if (q->next == NULL) { + q->next = p; + p->next = NULL; + start = q; + return; + } else { + reverse(q, q->next); + q->next = p; + p->next = NULL; + } +} + +void show() { + node *t = start; + while (t != NULL) { + cout << t->val << "\t"; + t = t->next; + } +} + +int main() { + insert(1); + insert(2); + insert(3); + insert(4); + insert(5); + insert(6); + + reverse(start, start->next); + + show(); + + return 0; +} diff --git a/operations_on_datastructures/selectionSortLinkedList.cpp b/operations_on_datastructures/selectionSortLinkedList.cpp deleted file mode 100644 index 52363ceff..000000000 --- a/operations_on_datastructures/selectionSortLinkedList.cpp +++ /dev/null @@ -1,159 +0,0 @@ -#include -using namespace std; - -//node defined -class node -{ -public: - int data; - node *link; - node(int d) - { - data = d; - link = NULL; - } -}; - -//printing the linked list -void print(node *head) -{ - node *current = head; - while (current != NULL) - { - cout << current->data << " "; - current = current->link; - } - cout << endl; -} - -//creating the linked list with 'n' nodes -node *createlist(int n) -{ - node *head = NULL; - node *t = NULL; - for (int i = 0; i < n; i++) - { - node *temp = NULL; - int num; - cin >> num; - temp = new node(num); - if (head == NULL) - { - head = temp; - t = temp; - continue; - } - if (t->link == NULL) - t->link = temp; - t = temp; - } - return head; -} - -//performing selection sort on the linked list in an iterative manner -void my_selection_sort_linked_list(node *&head) -{ - node *min = head; //throughout the algorithm 'min' is used to denote the node with min value out of all the nodes left for scanning - //while scanning if we find a node 'X' with value lesser than min, - //then we update the pointers in such a way that 'X' becomes the predecessor of 'min' - node *current = min->link; // 'current' refers to the current node we are scanning - node *previous = min; //'previous' refers to the node that is previous to the current node - node *temp = NULL; // 'temp' in this algo is used to point to the last node of the sorted part of the linked list. - //eg. If at any time instance the state of the linked list is suppose 1->2->5->3->8->NULL - //then, we see that "1->2" is the sorted part of the LL, and therefore temp will be pointing to the last node of the sorted part,i.e,'2' - //We keep on arranging the Linked list in such a way that after each iteration the node with 'min' value is placed at its correct position. - //Eg. Let suppose initially we have 5->4->1->3->2->NULL - //After 1st iteration : 1->4->5->3->2->NULL and so on - - while (min->link != NULL) //so that all the nodes are scanned or until there exists a node - { - //pick the first node from the unsorted part and assume that it is the minimum and then start scanning from the next node - - while (current != NULL) //suppose you choose the min node to be X, then scan starts from the (X+1)th node until its NULL. current = (X+1)th node and min = X - { - if (current->data < min->data) //if the current node is smaller than the presumed node 'min' - { - if (temp == NULL) //temp stays null for the first iteration, therefore it symbolizes that we are scanning for the first time - { - if (previous == min) //if the 'previous' is pointing to the 'min' node - { - //Update the pointers - head = current; //update the head pointer with the current node - min->link = current->link; - current->link = previous; - min = current; - current = previous->link; - } - else //if the 'previous' is not pointing to the 'min' node - { - //Update the pointers - head = current; //update the head pointer with the current node - previous->link = current->link; - current->link = min; - min = current; - current = previous->link; - } - } - else //if 'temp' is not NULL, i.e., its not the 1st iteration - { - temp->link = current; - previous->link = current->link; - current->link = min; - min = current; - current = previous->link; - } - } - else //if the current node is greater than min, just move the previous and the current pointer a step further - { - previous = previous->link; - current = current->link; - } - } - - //update the pointers. Set 'temp' to the last node in the sorted part. Make 'min' move a step further so that 'min' points to the 1st node of the unsorted part - //start the iteration again - temp = min; - min = min->link; - previous = min; - current = min->link; - } -} - -// Test cases: - -// enter the no. of nodes : 5 -// 8 9 3 1 4 -// original list is : 8 9 3 1 4 -// sorted list is : 1 3 4 8 9 - -// enter the no. of nodes : 3 -// -1 -2 -3 -// original list is : -1 -2 -3 -// sorted list is : -3 -2 -1 - -// enter the no. of nodes : 8 -// 8 7 6 5 4 3 2 1 -// original list is : 8 7 6 5 4 3 2 1 -// sorted list is : 1 2 3 4 5 6 7 8 - -// enter the no. of nodes : 6 -// 5 3 4 1 -2 -4 -// original list is : 5 3 4 1 -2 -4 -// sorted list is : -4 -2 1 3 4 5 - -int main() -{ - node *head = NULL; - int n; - cout << "enter the no. of nodes : "; //taking input from user about the number of nodes in linked list - cin >> n; - if (n == 0) - return 0; - head = createlist(n); //creating the list - cout << "original list is : "; - print(head); //printing the original linked list - my_selection_sort_linked_list(head); //applying selection sort - cout << "sorted list is : "; - print(head); //printing the sorted linked list - return 0; -} \ No newline at end of file diff --git a/operations_on_datastructures/selectionsortlinkedlist.cpp b/operations_on_datastructures/selectionsortlinkedlist.cpp new file mode 100644 index 000000000..0e8e80def --- /dev/null +++ b/operations_on_datastructures/selectionsortlinkedlist.cpp @@ -0,0 +1,172 @@ +#include +using namespace std; + +// node defined +class node { + public: + int data; + node *link; + node(int d) { + data = d; + link = NULL; + } +}; + +// printing the linked list +void print(node *head) { + node *current = head; + while (current != NULL) { + cout << current->data << " "; + current = current->link; + } + cout << endl; +} + +// creating the linked list with 'n' nodes +node *createlist(int n) { + node *head = NULL; + node *t = NULL; + for (int i = 0; i < n; i++) { + node *temp = NULL; + int num; + cin >> num; + temp = new node(num); + if (head == NULL) { + head = temp; + t = temp; + continue; + } + if (t->link == NULL) + t->link = temp; + t = temp; + } + return head; +} + +// performing selection sort on the linked list in an iterative manner +void my_selection_sort_linked_list(node *&head) { + node *min = head; // throughout the algorithm 'min' is used to denote the + // node with min value out of all the nodes left for + // scanning while scanning if we find a node 'X' with + // value lesser than min, then we update the pointers in + // such a way that 'X' becomes the predecessor of 'min' + node *current = + min->link; // 'current' refers to the current node we are scanning + node *previous = min; //'previous' refers to the node that is previous to + // the current node + node *temp = + NULL; // 'temp' in this algo is used to point to the last node of the + // sorted part of the linked list. + // eg. If at any time instance the state of the linked list is + // suppose 1->2->5->3->8->NULL then, we see that "1->2" is the + // sorted part of the LL, and therefore temp will be pointing to + // the last node of the sorted part,i.e,'2' We keep on arranging + // the Linked list in such a way that after each iteration the + // node with 'min' value is placed at its correct position. Eg. + // Let suppose initially we have 5->4->1->3->2->NULL After 1st + // iteration : 1->4->5->3->2->NULL and so on + + while ( + min->link != + NULL) // so that all the nodes are scanned or until there exists a node + { + // pick the first node from the unsorted part and assume that it is the + // minimum and then start scanning from the next node + + while (current != NULL) // suppose you choose the min node to be X, + // then scan starts from the (X+1)th node until + // its NULL. current = (X+1)th node and min = X + { + if (current->data < min->data) // if the current node is smaller + // than the presumed node 'min' + { + if (temp == NULL) // temp stays null for the first iteration, + // therefore it symbolizes that we are + // scanning for the first time + { + if (previous == + min) // if the 'previous' is pointing to the 'min' node + { + // Update the pointers + head = current; // update the head pointer with the + // current node + min->link = current->link; + current->link = previous; + min = current; + current = previous->link; + } else // if the 'previous' is not pointing to the 'min' + // node + { + // Update the pointers + head = current; // update the head pointer with the + // current node + previous->link = current->link; + current->link = min; + min = current; + current = previous->link; + } + } else // if 'temp' is not NULL, i.e., its not the 1st + // iteration + { + temp->link = current; + previous->link = current->link; + current->link = min; + min = current; + current = previous->link; + } + } else // if the current node is greater than min, just move the + // previous and the current pointer a step further + { + previous = previous->link; + current = current->link; + } + } + + // update the pointers. Set 'temp' to the last node in the sorted part. + // Make 'min' move a step further so that 'min' points to the 1st node + // of the unsorted part start the iteration again + temp = min; + min = min->link; + previous = min; + current = min->link; + } +} + +// Test cases: + +// enter the no. of nodes : 5 +// 8 9 3 1 4 +// original list is : 8 9 3 1 4 +// sorted list is : 1 3 4 8 9 + +// enter the no. of nodes : 3 +// -1 -2 -3 +// original list is : -1 -2 -3 +// sorted list is : -3 -2 -1 + +// enter the no. of nodes : 8 +// 8 7 6 5 4 3 2 1 +// original list is : 8 7 6 5 4 3 2 1 +// sorted list is : 1 2 3 4 5 6 7 8 + +// enter the no. of nodes : 6 +// 5 3 4 1 -2 -4 +// original list is : 5 3 4 1 -2 -4 +// sorted list is : -4 -2 1 3 4 5 + +int main() { + node *head = NULL; + int n; + cout << "enter the no. of nodes : "; // taking input from user about the + // number of nodes in linked list + cin >> n; + if (n == 0) + return 0; + head = createlist(n); // creating the list + cout << "original list is : "; + print(head); // printing the original linked list + my_selection_sort_linked_list(head); // applying selection sort + cout << "sorted list is : "; + print(head); // printing the sorted linked list + return 0; +} \ No newline at end of file diff --git a/operations_on_datastructures/union_of_2_arrays.cpp b/operations_on_datastructures/union_of_2_arrays.cpp new file mode 100644 index 000000000..cdacf1d2e --- /dev/null +++ b/operations_on_datastructures/union_of_2_arrays.cpp @@ -0,0 +1,27 @@ +#include +int main() { + int m, n, i = 0, j = 0; + cout << "Enter size of both arrays:"; + cin >> m >> n; + int a[m]; + int b[n]; + cout << "Enter elements of array 1:"; + for (i = 0; i < m; i++) cin >> a[i]; + cout << "Enter elements of array 2:"; + for (i = 0; i < n; i++) cin >> b[i]; + i = 0; + j = 0; + while ((i < m) && (j < n)) { + if (a[i] < b[j]) + cout << a[i++] << " "; + else if (a[i] > b[j]) + cout << b[j++] << " "; + else { + cout << a[i++]; + j++; + } + } + while (i < m) cout << a[i++] << " "; + while (j < n) cout << b[j++] << " "; + return 0; +} diff --git a/others/Buzz_number.cpp b/others/Buzz_number.cpp deleted file mode 100644 index f31038aad..000000000 --- a/others/Buzz_number.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//A buzz number is a number that is either divisble by 7 or has last digit as 7. -#include -using namespace std; -int main() -{ - int n, t; - cin >> t; - while (t--) - { - cin >> n; - if ((n % 7 == 0) || (n % 10 == 7)) - cout << n << " is a buzz number" << endl; - else - cout << n << " is not a buzz number" << endl; - } - return 0; -} diff --git a/others/CMakeLists.txt b/others/CMakeLists.txt new file mode 100644 index 000000000..f049b5f2d --- /dev/null +++ b/others/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/others") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/others/Decimal To Binary.cpp b/others/Decimal To Binary.cpp deleted file mode 100644 index 4e2119ebc..000000000 --- a/others/Decimal To Binary.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// This function convert decimal to binary number -// -#include -using namespace std; - -int main() -{ - int number; - cout << "Enter a number:"; - cin >> number; - int remainder, binary = 0, var = 1; - - do - { - remainder = number % 2; - number = number / 2; - binary = binary + (remainder * var); - var = var * 10; - - } while (number > 0); - cout << "the binary is :"; - cout << binary; - cout << endl; - return 0; -} diff --git a/others/Decimal To Hexadecimal .cpp b/others/Decimal To Hexadecimal .cpp deleted file mode 100644 index 705f21ba4..000000000 --- a/others/Decimal To Hexadecimal .cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -using namespace std; - -int main(void) -{ - int valueToConvert = 0; //Holds user input - int hexArray[8]; //Contains hex values backwards - int i = 0; //counter - char HexValues[] = "0123456789ABCDEF"; - - cout << "Enter a Decimal Value" << endl; //Displays request to stdout - cin >> valueToConvert; //Stores value into valueToConvert via user input - - while (valueToConvert > 15) - { //Dec to Hex Algorithm - hexArray[i++] = valueToConvert % 16; //Gets remainder - valueToConvert /= 16; - } - hexArray[i] = valueToConvert; //Gets last value - - cout << "Hex Value: "; - while (i >= 0) - cout << HexValues[hexArray[i--]]; - - cout << endl; - return 0; -} diff --git a/others/GCD_of_n_numbers.cpp b/others/GCD_of_n_numbers.cpp deleted file mode 100644 index 8158052f8..000000000 --- a/others/GCD_of_n_numbers.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//This program aims at calculating the GCD of n numbers by division method -#include -using namepsace std; -int main() -{ - cout << "Enter value of n:" << endl; - cin >> n; - int a[n]; - int i, j, gcd; - cout << "Enter the n numbers:" << endl; - for (i = 0; i < n; i++) - cin >> a[i]; - j = 1; //to access all elements of the array starting from 1 - gcd = a[0]; - while (j < n) - { - if (a[j] % gcd == 0) //value of gcd is as needed so far - j++; //so we check for next element - else - gcd = a[j] % gcd; //calculating GCD by division method - } - cout << "GCD of entered n numbers:" << gcd; -} diff --git a/others/Palindromeofnumber.cpp b/others/Palindromeofnumber.cpp deleted file mode 100644 index 647803997..000000000 --- a/others/Palindromeofnumber.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using namespace std; - -int main() -{ - int num; - cout << "Enter number = "; - cin >> num; - - string s1 = to_string(num); - string s2 = s1; - - reverse(s1.begin(), s1.end()); - - if (s1 == s2) - cout << "true"; - else - cout << "false"; - - return 0; -} diff --git a/others/Paranthesis Matching.cpp b/others/Paranthesis Matching.cpp deleted file mode 100644 index d2bb4d39c..000000000 --- a/others/Paranthesis Matching.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include - -using namespace std; - -#define MAX 100 - -// -------------- stack -------------- - -char stack[MAX]; -int top = -1; - -void push(char ch) -{ - stack[++top] = ch; -} - -char pop() -{ - return stack[top--]; -} - -// -------------- end stack ----------- - -char opening(char ch) -{ - switch (ch) - { - case '}': - return '{'; - case ']': - return '['; - case ')': - return '('; - case '>': - return '<'; - } -} - -int main() -{ - - string exp; - int valid = 1, i = 0; - cout << "Enter The Expression : "; - cin >> exp; - - while (valid == 1 && i < exp.length()) - { - if (exp[i] == '(' || exp[i] == '{' || exp[i] == '[' || exp[i] == '<') - { - push(exp[i]); - } - else if (top >= 0 && stack[top] == opening(exp[i])) - { - pop(); - } - else - { - valid = 0; - } - i++; - } - - // makes sure the stack is empty after processsing (above) - if (valid == 1 && top == -1) - { - cout << "\nCorrect Expression"; - } - else - { - cout << "\nWrong Expression"; - } - - return 0; -} diff --git a/others/Primality Test.cpp b/others/Primality Test.cpp deleted file mode 100644 index ce8fc1706..000000000 --- a/others/Primality Test.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -using namespace std; - -//A simple and efficient implementation of a function to test if a number is prime, based on the fact that -//Every Prime number, except 2 and 3 are of the form 6*k+1 or 6*k-1 for integer values of k. - -bool IsPrime(int number) -{ - if (((!(number & 1)) && number != 2) || (number < 2) || (number % 3 == 0 && number != 3)) - return false; - - for (int k = 1; 36 * k * k - 12 * k < number; ++k) - { - if ((number % (6 * k + 1) == 0) || (number % (6 * k - 1) == 0)) - return false; - } - return true; -} - -int main() -{ - //Main Function - cout << "Enter the value of n to check if Prime\n"; - int n; - cin >> n; - if (IsPrime(n)) - cout << n << " is Prime" << endl; - else - cout << n << " is not Prime" << endl; - - return 0; -} diff --git a/others/Sparse matrix.cpp b/others/Sparse matrix.cpp deleted file mode 100644 index 1861163f1..000000000 --- a/others/Sparse matrix.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/*A sparse matrix is a matrix which has number of zeroes greater than (m*n)/2, -where m and n are the dimensions of the matrix.*/ -#include -using namespace std; - -int main() -{ - int m, n; - int counterZeros = 0; - cout << "Enter dimensions of matrix (seperated with space): "; - cin >> m >> n; - int a[m][n]; - cout << "Enter matrix elements:"; - cout << "\n"; - - // reads the matrix from stdin - for (int i = 0; i < m; i++) - { - for (int j = 0; j < n; j++) - { - cout << "element? "; - cin >> a[i][j]; - } - } - - // counts the zero's - for (int i = 0; i < m; i++) - { - for (int j = 0; j < n; j++) - { - if (a[i][j] == 0) - counterZeros++; //Counting number of zeroes - } - } - - // makes sure the matrix is a sparse matrix - if (counterZeros > ((m * n) / 2)) //Checking for sparse matrix - cout << "Sparse matrix"; - else - cout << "Not a sparse matrix"; -} diff --git a/others/Strassen Matrix Multiplication.cpp b/others/Strassen Matrix Multiplication.cpp deleted file mode 100644 index 85b627763..000000000 --- a/others/Strassen Matrix Multiplication.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -using namespace std; - -Multiply(int A[][], int B[][], int n) -{ - if (n == 2) - { - int p1 = (a[0][0] + a[1][1]) * (b[0][0] + b[1][1]); - int p2 = (a[1][0] + a[1][1]) * b[0][0]; - int p3 = a[0][0] * (b[0][1] - b[1][1]); - int p4 = a[1][1] * (b[1][0] - b[0][0]); - int p5 = (a[0][0] + a[0][1]) * b[1][1]; - int p6 = (a[1][0] - a[0][0]) * (b[0][0] + b[0][1]); - int p7 = (a[0][1] - a[1][1]) * (b[1][0] + b[1][1]); - - int c[n][n]; - c[0][0] = p1 + p4 - p5 + p7; - c[0][1] = p3 + p5; - c[1][0] = p2 + p4; - c[1][1] = p1 - p2 + p3 + p6; - - return c[][]; - } - else - { - } -} - -int main() -{ - int p, q, r, s; - cout << "Enter the dimensions of Matrices"; - cin >> n; - int A[n][n], ; - int B[n][n], ; - cout << "Enter the elements of Matrix A"; - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - cin >> A[i][j]; - } - } - - cout << "Enter the elements of Matrix B"; - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - cin >> B[i][j]; - } - } - - Multiply(A, B, n); - return 0; -} \ No newline at end of file diff --git a/others/String Fibonacci.cpp b/others/String Fibonacci.cpp deleted file mode 100644 index e5475eec9..000000000 --- a/others/String Fibonacci.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//This Programme returns the Nth fibonacci as a string. -//The method used is manual addition with carry and placing it in a string which is called string addition -//This makes it have no bounds or limits - -#include -#include - -using namespace std; - -string add(string a, string b) -{ - string temp = ""; - - // carry flag - int carry = 0; - - // fills up with zeros - while ((int)a.length() < (int)b.length()) - { - a = "0" + a; - } - - // fills up with zeros - while ((int)b.length() < (int)a.length()) - { - b = "0" + b; - } - - // adds the numbers a and b - for (int i = a.length() - 1; i >= 0; i--) - { - char val = (char)(((a[i] - 48) + (b[i] - 48)) + 48 + carry); - if (val > 57) - { - carry = 1; - val -= 10; - } - else - { - carry = 0; - } - temp = val + temp; - } - - // processes the carry flag - if (carry == 1) - { - temp = "1" + temp; - } - - // removes leading zeros. - while (temp[0] == '0' && temp.length() > 1) - { - temp = temp.substr(1); - } - - return temp; -} - -void fib_Accurate(long long n) -{ - string tmp = ""; - string fibMinus1 = "1"; - string fibMinus2 = "0"; - for (long long i = 0; i < n; i++) - { - tmp = add(fibMinus1, fibMinus2); - fibMinus2 = fibMinus1; - fibMinus1 = tmp; - } - cout << fibMinus2; -} - -int main() -{ - int n; - cout << "Enter whatever number N you want to find the fibonacci of\n"; - cin >> n; - cout << n << " th Fibonacci is \n"; - fib_Accurate(n); - - return 0; -} diff --git a/others/Tower of Hanoi.cpp b/others/Tower of Hanoi.cpp deleted file mode 100644 index 5783d6a98..000000000 --- a/others/Tower of Hanoi.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -using namespace std; - -struct tower -{ - int values[10]; - int top; -} F, U, T; - -void show() -{ - cout << "\n\n\tF : "; - for (int i = 0; i < F.top; i++) - { - cout << F.values[i] << "\t"; - } - cout << "\n\tU : "; - for (int i = 0; i < U.top; i++) - { - cout << U.values[i] << "\t"; - } - cout << "\n\tT : "; - for (int i = 0; i < T.top; i++) - { - cout << T.values[i] << "\t"; - } -} - -void mov(tower &From, tower &To) -{ - --From.top; - To.values[To.top] = From.values[From.top]; - ++To.top; -} - -void TH(int n, tower &From, tower &Using, tower &To) -{ - - if (n == 1) - { - mov(From, To); - show(); - } - else - { - TH(n - 1, From, To, Using); - mov(From, To); - show(); - TH(n - 1, Using, From, To); - } -} - -int main() -{ - F.top = 0; - U.top = 0; - T.top = 0; - - int no; - - cout << "\nEnter number of discs : "; - cin >> no; - - for (int i = no; i > 0; i--) - { - F.values[F.top++] = i; - }; - - show(); - TH(no, F, U, T); - - return 0; -} diff --git a/others/buzz_number.cpp b/others/buzz_number.cpp new file mode 100644 index 000000000..ed9fc5f28 --- /dev/null +++ b/others/buzz_number.cpp @@ -0,0 +1,20 @@ +/** + * @file + * @brief A buzz number is a number that is either divisible by 7 or has last + * digit as 7. + */ +#include + +/** main function */ +int main() { + int n, t; + std::cin >> t; + while (t--) { + std::cin >> n; + if ((n % 7 == 0) || (n % 10 == 7)) + std::cout << n << " is a buzz number" << std::endl; + else + std::cout << n << " is not a buzz number" << std::endl; + } + return 0; +} diff --git a/others/decimal_to_binary.cpp b/others/decimal_to_binary.cpp new file mode 100644 index 000000000..11ce064a5 --- /dev/null +++ b/others/decimal_to_binary.cpp @@ -0,0 +1,55 @@ +/** + * @file + * @brief Function to convert decimal number to binary representation + */ +#include + +/** + * This method converts the bit representation and stores it as a decimal + * number. + */ +void method1(int number) { + int remainder, binary = 0, var = 1; + + do { + remainder = number % 2; + number = number / 2; + binary = binary + (remainder * var); + var = var * 10; + } while (number > 0); + std::cout << "Method 1 : " << binary << std::endl; +} + +/** + * This method stores each bit value from LSB to MSB and then prints them back + * from MSB to LSB + */ +void method2(int number) { + int num_bits = 0; + char bit_string[50]; + + do { + bool bit = number & 0x01; // get last bit + if (bit) + bit_string[num_bits++] = '1'; + else + bit_string[num_bits++] = '0'; + number >>= 1; // right shift bit 1 bit + } while (number > 0); + + std::cout << "Method 2 : "; + while (num_bits >= 0) + std::cout << bit_string[num_bits--]; // print from MSB to LSB + std::cout << std::endl; +} + +int main() { + int number; + std::cout << "Enter a number:"; + std::cin >> number; + + method1(number); + method2(number); + + return 0; +} diff --git a/others/decimal_to_hexadecimal.cpp b/others/decimal_to_hexadecimal.cpp new file mode 100644 index 000000000..a3e544f49 --- /dev/null +++ b/others/decimal_to_hexadecimal.cpp @@ -0,0 +1,34 @@ +/** + * @file + * @brief Convert decimal number to hexadecimal representation + */ + +#include + +/** + * Main program + */ +int main(void) { + int valueToConvert = 0; // Holds user input + int hexArray[8]; // Contains hex values backwards + int i = 0; // counter + char HexValues[] = "0123456789ABCDEF"; + + std::cout << "Enter a Decimal Value" + << std::endl; // Displays request to stdout + std::cin >> + valueToConvert; // Stores value into valueToConvert via user input + + while (valueToConvert > 15) { // Dec to Hex Algorithm + hexArray[i++] = valueToConvert % 16; // Gets remainder + valueToConvert /= 16; + // valueToConvert >>= 4; // This will divide by 2^4=16 and is faster + } + hexArray[i] = valueToConvert; // Gets last value + + std::cout << "Hex Value: "; + while (i >= 0) std::cout << HexValues[hexArray[i--]]; + + std::cout << std::endl; + return 0; +} diff --git a/others/Decimal to Roman Numeral.cpp b/others/decimal_to_roman_numeral.cpp similarity index 54% rename from others/Decimal to Roman Numeral.cpp rename to others/decimal_to_roman_numeral.cpp index 0372e8003..ad4aa32c5 100644 --- a/others/Decimal to Roman Numeral.cpp +++ b/others/decimal_to_roman_numeral.cpp @@ -1,31 +1,33 @@ -//This Programme Converts a given decimal number in the range [0,4000) -//to both Lower case and Upper case Roman Numeral +/** + * @file + * @brief This Programme Converts a given decimal number in the range [0,4000) + * to both Lower case and Upper case Roman Numeral + */ #include #include -#include +#include #include -using namespace std; -//This functions fills a string with character c, n times and returns it -string fill(char c, int n) -{ - string s = ""; - while (n--) - s += c; +/** This functions fills a string with character c, n times and returns it + * @note This can probably be replace by `memcpy` function. + */ +std::string fill(char c, int n) { + std::string s = ""; + while (n--) s += c; return s; } -//to convert to lowercase Roman Numeral -// the function works recursively -string tolowerRoman(int n) -{ +/** to convert to lowercase Roman Numeral + * the function works recursively + */ +std::string tolowerRoman(int n) { if (n < 4) return fill('i', n); if (n < 6) return fill('i', 5 - n) + "v"; if (n < 9) - return string("v") + fill('i', n - 5); + return std::string("v") + fill('i', n - 5); if (n < 11) return fill('i', 10 - n) + "x"; if (n < 40) @@ -33,7 +35,7 @@ string tolowerRoman(int n) if (n < 60) return fill('x', 5 - n / 10) + 'l' + tolowerRoman(n % 10); if (n < 90) - return string("l") + fill('x', n / 10 - 5) + tolowerRoman(n % 10); + return std::string("l") + fill('x', n / 10 - 5) + tolowerRoman(n % 10); if (n < 110) return fill('x', 10 - n / 10) + "c" + tolowerRoman(n % 10); if (n < 400) @@ -41,7 +43,8 @@ string tolowerRoman(int n) if (n < 600) return fill('c', 5 - n / 100) + 'd' + tolowerRoman(n % 100); if (n < 900) - return string("d") + fill('c', n / 100 - 5) + tolowerRoman(n % 100); + return std::string("d") + fill('c', n / 100 - 5) + + tolowerRoman(n % 100); if (n < 1100) return fill('c', 10 - n / 100) + "m" + tolowerRoman(n % 100); if (n < 4000) @@ -49,16 +52,16 @@ string tolowerRoman(int n) return "?"; } -//to convert to uppercase Roman Numeral -// the function works recursively -string toupperRoman(int n) -{ +/** to convert to uppercase Roman Numeral + * the function works recursively + */ +std::string toupperRoman(int n) { if (n < 4) return fill('I', n); if (n < 6) return fill('I', 5 - n) + "V"; if (n < 9) - return string("V") + fill('I', n - 5); + return std::string("V") + fill('I', n - 5); if (n < 11) return fill('I', 10 - n) + "X"; if (n < 40) @@ -66,7 +69,7 @@ string toupperRoman(int n) if (n < 60) return fill('X', 5 - n / 10) + 'L' + toupperRoman(n % 10); if (n < 90) - return string("L") + fill('X', n / 10 - 5) + toupperRoman(n % 10); + return std::string("L") + fill('X', n / 10 - 5) + toupperRoman(n % 10); if (n < 110) return fill('X', 10 - n / 10) + "C" + toupperRoman(n % 10); if (n < 400) @@ -74,7 +77,8 @@ string toupperRoman(int n) if (n < 600) return fill('C', 5 - n / 100) + 'D' + toupperRoman(n % 100); if (n < 900) - return string("D") + fill('C', n / 100 - 5) + toupperRoman(n % 100); + return std::string("D") + fill('C', n / 100 - 5) + + toupperRoman(n % 100); if (n < 1100) return fill('C', 10 - n / 100) + "M" + toupperRoman(n % 100); if (n < 4000) @@ -82,16 +86,13 @@ string toupperRoman(int n) return "?"; } -//main function - -int main() -{ - +/** main function */ +int main() { int n; - cout << "\t\tRoman numbers converter\n\n"; - cout << "Type in decimal number between 0 up to 4000 (exclusive): "; - cin >> n; - cout << n << " in Upper Roman Numerals is " << toupperRoman(n) << "\n"; - cout << n << " in Lower Roman Numerals is " << tolowerRoman(n) << "\n"; + std::cout << "\t\tRoman numbers converter\n\n"; + std::cout << "Type in decimal number between 0 up to 4000 (exclusive): "; + std::cin >> n; + std::cout << n << " in Upper Roman Numerals is " << toupperRoman(n) << "\n"; + std::cout << n << " in Lower Roman Numerals is " << tolowerRoman(n) << "\n"; return 0; } diff --git a/others/fast_interger_input.cpp b/others/fast_interger_input.cpp index 3358fc8bb..87963c9ad 100644 --- a/others/fast_interger_input.cpp +++ b/others/fast_interger_input.cpp @@ -1,7 +1,15 @@ -// Read integers in the fastest way in c plus plus -#include +/** + * @file + * @brief Read integers from stdin continuously as they are entered without + * waiting for the `\n` character + */ +#include + +/** Function to read the number from stdin. The function reads input until a non + * numeric character is entered. + */ void fastinput(int *number) { -// variable to indicate sign of input integer + // variable to indicate sign of input integer bool negative = false; register int c; *number = 0; @@ -19,7 +27,7 @@ void fastinput(int *number) { // Keep on extracting characters if they are integers // i.e ASCII Value lies from '0'(48) to '9' (57) for (; (c > 47 && c < 58); c = std::getchar()) - *number = *number *10 + c - 48; + *number = *number * 10 + c - 48; // if scanned input has a negative sign, negate the // value of the input number @@ -27,10 +35,10 @@ void fastinput(int *number) { *(number) *= -1; } -// Function Call +/** Main function */ int main() { int number; fastinput(&number); - std::cout << number << "\n"; + std::cout << number << std::endl; return 0; } diff --git a/others/fibonacci.cpp b/others/fibonacci.cpp deleted file mode 100644 index 87ccda6d3..000000000 --- a/others/fibonacci.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//An efficient way to calculate nth fibonacci number faster and simpler than O(nlogn) method of matrix exponentiation -//This works by using both recursion and dynamic programming. -//as 93rd fibonacci exceeds 19 digits, which cannot be stored in a single long long variable, we can only use it till 92nd fibonacci -//we can use it for 10000th fibonacci etc, if we implement bigintegers. -//This algorithm works with the fact that nth fibonacci can easily found if we have already found n/2th or (n+1)/2th fibonacci -//It is a property of fibonacci similar to matrix exponentiation. - -#include -#include -using namespace std; - -const long long MAX = 93; - -long long f[MAX] = {0}; - -long long fib(long long n) -{ - - if (n == 0) - return 0; - if (n == 1 || n == 2) - return (f[n] = 1); - - if (f[n]) - return f[n]; - - long long k = (n % 2 != 0) ? (n + 1) / 2 : n / 2; - - f[n] = (n % 2 != 0) ? (fib(k) * fib(k) + fib(k - 1) * fib(k - 1)) - : (2 * fib(k - 1) + fib(k)) * fib(k); - return f[n]; -} - -int main() -{ - //Main Function - for (long long i = 1; i < 93; i++) - { - cout << i << " th fibonacci number is " << fib(i) << "\n"; - } - return 0; -} diff --git a/others/happy_number.cpp b/others/happy_number.cpp index 7d25a1bbd..b1debaa54 100644 --- a/others/happy_number.cpp +++ b/others/happy_number.cpp @@ -1,28 +1,39 @@ -/* A happy number is a number whose sum of digits is calculated until the sum is a single digit, - and this sum turns out to be 1 */ - -// Copyright 2019 TheAlgorithms contributors +/** + * @file + * @brief A happy number is a number whose sum of digits is calculated until the + * sum is a single digit, and this sum turns out to be 1 + */ #include -int main() { - int n, k, s = 0, d; - std::cout << "Enter a number:"; - std::cin >> n; - s = 0; - k = n; - while (k > 9) { - while (k != 0) { - d = k % 10; - s += d; - k /= 10; +/** + * Checks if a decimal number is a happy number + * \returns true if happy else false + */ +template +bool is_happy(T n) { + T s = 0; // stores sum of digits + while (n > 9) { // while number is > 9, there are more than 1 digit + while (n != 0) { // get digit + T d = n % 10; + s += d; + n /= 10; + } + n = s; + s = 0; } - k = s; - s = 0; - } - if (k == 1) - std::cout << n << " is a happy number" << std::endl; - else - std::cout << n << " is not a happy number" << std::endl; - return 0; + return (n == 1) ? true : false; // true if k == 1 +} + +/** Main function */ +int main() { + int n; + std::cout << "Enter a number:"; + std::cin >> n; + + if (is_happy(n)) + std::cout << n << " is a happy number" << std::endl; + else + std::cout << n << " is not a happy number" << std::endl; + return 0; } diff --git a/others/matrix_exponentiation.cpp b/others/matrix_exponentiation.cpp index 25c411dda..d44d22593 100644 --- a/others/matrix_exponentiation.cpp +++ b/others/matrix_exponentiation.cpp @@ -1,38 +1,64 @@ -/* -Matrix Exponentiation. +/** +@file +@brief Matrix Exponentiation. + The problem can be solved with DP but constraints are high. -ai = bi (for i <= k) -ai = c1*ai-1 + c2*ai-2 + ... + ck*ai-k (for i > k) -Taking the example of Fibonacci series, K=2 -b1 = 1, b2=1 -c1 = 1, c2=1 -a = 0 1 1 2 .... -This way you can find the 10^18 fibonacci number%MOD. +
\f$a_i = b_i\f$ (for \f$i <= k\f$) +
\f$a_i = c_1 a_{i-1} + c_2 a_{i-2} + ... + c_k a_{i-k}\f$ (for \f$i > k\f$) +
Taking the example of Fibonacci series, \f$k=2\f$ +
\f$b_1 = 1,\; b_2=1\f$ +
\f$c_1 = 1,\; c_2=1\f$ +
\f$a = \begin{bmatrix}0& 1& 1& 2& \ldots\end{bmatrix}\f$ +
This way you can find the \f$10^{18}\f$ fibonacci number%MOD. I have given a general way to use it. The program takes the input of B and C matrix. + Steps for Matrix Expo 1. Create vector F1 : which is the copy of B. 2. Create transpose matrix (Learn more about it on the internet) -3. Perform T^(n-1) [transpose matrix to the power n-1] -4. Multiply with F to get the last matrix of size (1xk). +3. Perform \f$T^{n-1}\f$ [transpose matrix to the power n-1] +4. Multiply with F to get the last matrix of size (1\f$\times\f$k). + The first element of this matrix is the required result. */ #include +#include + using std::cin; using std::cout; using std::vector; +/*! shorthand definition for `int64_t` */ #define ll int64_t -#define endl '\n' + +/*! shorthand definition for `std::endl` */ +#define endl std::endl + +/*! shorthand definition for `int64_t` */ #define pb push_back #define MOD 1000000007 -ll ab(ll x) { return x > 0LL ? x : -x; } + +/** returns absolute value */ +inline ll ab(ll x) { return x > 0LL ? x : -x; } + +/** global variable k + * @todo @stepfencurryxiao add documetnation + */ ll k; + +/** global vector variables + * @todo @stepfencurryxiao add documetnation + */ vector a, b, c; -// To multiply 2 matrix -vector> multiply(vector> A, vector> B) { +/** To multiply 2 matrices + * \param [in] A matrix 1 of size (m\f$\times\f$n) + * \param [in] B \p matrix 2 of size (p\f$\times\f$q)\n\note \f$p=n\f$ + * \result matrix of dimension (m\f$\times\f$q) + */ +vector> multiply(const vector> &A, + const vector> &B) { vector> C(k + 1, vector(k + 1)); for (ll i = 1; i <= k; i++) { for (ll j = 1; j <= k; j++) { @@ -44,8 +70,13 @@ vector> multiply(vector> A, vector> B) { return C; } -// computing power of a matrix -vector> power(vector> A, ll p) { +/** computing integer power of a matrix using recursive multiplication. + * @note A must be a square matrix for this algorithm. + * \param [in] A base matrix + * \param [in] p exponent + * \return matrix of same dimension as A + */ +vector> power(const vector> &A, ll p) { if (p == 1) return A; if (p % 2 == 1) { @@ -56,7 +87,10 @@ vector> power(vector> A, ll p) { } } -// main function +/*! Wrapper for Fibonacci + * \param[in] n \f$n^\text{th}\f$ Fibonacci number + * \return \f$n^\text{th}\f$ Fibonacci number + */ ll ans(ll n) { if (n == 0) return 0; @@ -64,8 +98,7 @@ ll ans(ll n) { return b[n - 1]; // F1 vector F1(k + 1); - for (ll i = 1; i <= k; i++) - F1[i] = b[i - 1]; + for (ll i = 1; i <= k; i++) F1[i] = b[i - 1]; // Transpose matrix vector> T(k + 1, vector(k + 1)); @@ -92,8 +125,7 @@ ll ans(ll n) { return res; } -// 1 1 2 3 5 - +/** Main function */ int main() { cin.tie(0); cout.tie(0); diff --git a/others/measure_time_elapsed.cpp b/others/measure_time_elapsed.cpp deleted file mode 100644 index d0830ab79..000000000 --- a/others/measure_time_elapsed.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// To calculate the time taken by a code to execute -#include -#include - -__int64_t getTimeInMicroseconds() { - struct timeval start; - gettimeofday(&start, NULL); - return start.tv_sec * 1000000 + start.tv_usec; -} - -// write function sample(args) - -int main() { - // write code - __int64_t starttime = getTimeInMicroseconds(); - // sample(args) function run - // Any other functions (if present) run - std::cout << getTimeInMicroseconds() - starttime; -} diff --git a/others/palindrome_of_number.cpp b/others/palindrome_of_number.cpp new file mode 100644 index 000000000..66401ff96 --- /dev/null +++ b/others/palindrome_of_number.cpp @@ -0,0 +1,35 @@ +/** + * @file + * @brief Check if a number is + * [palindrome](https://en.wikipedia.org/wiki/Palindrome) or not. + * + * This program cheats by using the STL library's std::reverse function. + */ +#include +#include + +#ifdef _MSC_VER +// Required to compile std::toString function using MSVC +#include +#else +#include +#endif + +/** Main function */ +int main() { + int num; + std::cout << "Enter number = "; + std::cin >> num; + + std::string s1 = std::to_string(num); // convert number to string + std::string s2 = s1; + + std::reverse(s1.begin(), s1.end()); // reverse the string + + if (s1 == s2) // check if reverse and original string are identical + std::cout << "true"; + else + std::cout << "false"; + + return 0; +} diff --git a/others/paranthesis_matching.cpp b/others/paranthesis_matching.cpp new file mode 100644 index 000000000..2a6358d94 --- /dev/null +++ b/others/paranthesis_matching.cpp @@ -0,0 +1,75 @@ +/** + * @file + * @brief Perform paranthesis matching. \note Do not know the application of + * this, however. + * @note Implementation is C-type and does not utilize the C++ constructs + * @todo implement as a C++ class + */ +#include +#ifdef _MSC_VER +#include // Visual Studio C requires this include +#else +#include +#endif + +/** check number */ +#define MAX 100 + +//! @{-------------- stack -------------- +//! global stack +char stack[MAX]; + +//! pointer to track stack index +int top = -1; + +//! push byte to stack variable +void push(char ch) { stack[++top] = ch; } + +//! pop a byte out of stack variable +char pop() { return stack[top--]; } + +//! @}-------------- end stack ----------- + +/** return opening paranthesis corresponding to the close paranthesis + * @param[in] ch closed paranthesis character + */ +char opening(char ch) { + switch (ch) { + case '}': + return '{'; + case ']': + return '['; + case ')': + return '('; + case '>': + return '<'; + } + return '\0'; +} + +int main() { + std::string exp; + int valid = 1, i = 0; + std::cout << "Enter The Expression : "; + std::cin >> exp; + + while (valid == 1 && i < exp.length()) { + if (exp[i] == '(' || exp[i] == '{' || exp[i] == '[' || exp[i] == '<') { + push(exp[i]); + } else if (top >= 0 && stack[top] == opening(exp[i])) { + pop(); + } else { + valid = 0; + } + i++; + } + + // makes sure the stack is empty after processsing (above) + if (valid == 1 && top == -1) { + std::cout << "\nCorrect Expression"; + } else { + std::cout << "\nWrong Expression"; + } + + return 0; +} diff --git a/others/pascal_triangle.cpp b/others/pascal_triangle.cpp index 101100018..4ea58f3f1 100644 --- a/others/pascal_triangle.cpp +++ b/others/pascal_triangle.cpp @@ -1,63 +1,75 @@ -#include +/** + * @file + * @brief Pascal's triangle implementation + */ +#ifdef _MSC_VER +#include // required for Visual C +#else +#include +#endif +#include +#include -using namespace std; - -void show_pascal(int **arr, int n) -{ - //pint Pascal's Triangle - for (int i = 0; i < n; ++i) - { - for (int j = 0; j < n + i; ++j) - { - if (arr[i][j] == 0) - cout << " "; - else - cout << arr[i][j]; - } - cout << endl; - } +/** + * Print the triangle + * \param [in] arr 2D-array containing Pascal numbers + * \param [in] n depth of Pascal triangle to print + */ +void show_pascal(int **arr, int n) { + for (int i = 0; i < n; ++i) { + for (int j = 0; j < n + i; ++j) { + if (arr[i][j] == 0) + std::cout << std::setw(4) << " "; + else + std::cout << std::setw(4) << arr[i][j]; + } + std::cout << std::endl; + } } -int **pascal_triangle(int **arr, int n) -{ - for (int i = 0; i < n; ++i) - { - for (int j = n - i - 1; j < n + i; ++j) - { - if (j == n - i - 1 || j == n + i - 1) - arr[i][j] = 1; //The edge of the Pascal triangle goes in 1 - else - arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1]; - } - } +/** + * Print the triangle + * \param [in,out] arr array containing Pascal numbers + * \param [in] n depth of Pascal triangle to print + * \result arr pointer returned + */ +int **pascal_triangle(int **arr, int n) { + for (int i = 0; i < n; ++i) { + for (int j = n - i - 1; j < n + i; ++j) { + if (j == n - i - 1 || j == n + i - 1) + arr[i][j] = 1; // The edge of the Pascal triangle goes in 1 + else + arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1]; + } + } - return arr; + return arr; } -int main() -{ - int n = 0; +/** + * main function + */ +int main() { + int n = 0; - cout << "Set Pascal's Triangle Height" << endl; - cin >> n; - - //memory allocation (Assign two-dimensional array to store Pascal triangle) - int **arr = new int*[n]; - for (int i = 0; i < n; ++i) - { - arr[i] = new int[2 * n - 1]; - memset(arr[i], 0, sizeof(int)*(2 * n - 1)); - } - - pascal_triangle(arr, n); - show_pascal(arr, n); + std::cout << "Set Pascal's Triangle Height" << std::endl; + std::cin >> n; - //deallocation - for (int i = 0; i < n; ++i) - { - delete[] arr[i]; - } - delete[] arr; + // memory allocation (Assign two-dimensional array to store Pascal triangle) + int **arr = new int *[n]; + for (int i = 0; i < n; ++i) { + arr[i] = new int[2 * n - 1]; + memset(arr[i], 0, sizeof(int) * (2 * n - 1)); + } - return 0; + pascal_triangle(arr, n); + show_pascal(arr, n); + + // deallocation + for (int i = 0; i < n; ++i) { + delete[] arr[i]; + } + delete[] arr; + + return 0; } diff --git a/others/primality_test.cpp b/others/primality_test.cpp new file mode 100644 index 000000000..faec6589c --- /dev/null +++ b/others/primality_test.cpp @@ -0,0 +1,42 @@ +/** + * @file + * @brief [Primality test](https://en.wikipedia.org/wiki/Primality_test) + * implementation. + * + * A simple and efficient implementation of a function to test if a number is + * prime, based on the fact that + * > Every Prime number, except 2 and 3, are of the form \f$6k\pm1\f$ for + * > integer values of k. + * This gives a 3x speed improvement. + */ +#include + +/** Check if a number is prime + * \param[in] number number to check + * \returns true if prime else false + */ +bool IsPrime(int number) { + if (((!(number & 1)) && number != 2) || (number < 2) || + (number % 3 == 0 && number != 3)) + return false; + + for (int k = 1; 36 * k * k - 12 * k < number; ++k) { + if ((number % (6 * k + 1) == 0) || (number % (6 * k - 1) == 0)) + return false; + } + return true; +} + +/** main function */ +int main() { + // Main Function + std::cout << "Enter the value of n to check if Prime\n"; + int n; + std::cin >> n; + if (IsPrime(n)) + std::cout << n << " is Prime" << std::endl; + else + std::cout << n << " is not Prime" << std::endl; + + return 0; +} diff --git a/others/sieve_of_Eratosthenes.cpp b/others/sieve_of_Eratosthenes.cpp deleted file mode 100644 index e87ad4983..000000000 --- a/others/sieve_of_Eratosthenes.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Sieve of Eratosthenes is an algorithm to find the primes - * that is between 2 to N (as defined in main). - * - * Time Complexity : O(N) - * Space Complexity : O(N) - */ - -#include -using namespace std; - -#define MAX 10000000 - -int primes[MAX]; - -/* - * This is the function that finds the primes and eliminates - * the multiples. - */ -void sieve(int N) -{ - primes[0] = 1; - primes[1] = 1; - for (int i = 2; i <= N; i++) - { - if (primes[i] == 1) - continue; - for (int j = i + i; j <= N; j += i) - primes[j] = 1; - } -} - -/* - * This function prints out the primes to STDOUT - */ -void print(int N) -{ - for (int i = 0; i <= N; i++) - if (primes[i] == 0) - cout << i << ' '; - cout << '\n'; -} - -/* - * NOTE: This function is important for the - * initialization of the array. - */ -void init() -{ - for (int i = 0; i < MAX; i++) - primes[i] = 0; -} - -int main() -{ - int N = 100; - init(); - sieve(N); - print(N); -} diff --git a/others/smallest-circle.cpp b/others/smallest-circle.cpp deleted file mode 100644 index 48437cd86..000000000 --- a/others/smallest-circle.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include -#include - -using namespace std; - -struct Point -{ - double x, y; - Point(double a = 0.0, double b = 0.0) - { - x = a; - y = b; - } -}; - -double LenghtLine(Point A, Point B) -{ - return sqrt(abs((B.x - A.x) * (B.x - A.x)) + abs((B.y - A.y) * (B.y - A.y))); -} - -double TriangleArea(Point A, Point B, Point C) -{ - double a = LenghtLine(A, B); - double b = LenghtLine(B, C); - double c = LenghtLine(C, A); - double p = (a + b + c) / 2; - return sqrt(p * (p - a) * (p - b) * (p - c)); -} - -bool PointInCircle(vector &P, Point Center, double R) -{ - for (size_t i = 0; i < P.size(); i++) - { - if (LenghtLine(P[i], Center) > R) - return false; - } - return true; -} - -double circle(vector P) -{ - double minR = INT8_MAX; - double R; - Point C; - Point minC; - for (size_t i = 0; i < P.size() - 2; i++) - for (size_t j = i + 1; j < P.size(); j++) - for (size_t k = j + 1; k < P.size(); k++) - { - C.x = -0.5 * ((P[i].y * (P[j].x * P[j].x + P[j].y * P[j].y - P[k].x * P[k].x - P[k].y * P[k].y) + P[j].y * (P[k].x * P[k].x + P[k].y * P[k].y - P[i].x * P[i].x - P[i].y * P[i].y) + P[k].y * (P[i].x * P[i].x + P[i].y * P[i].y - P[j].x * P[j].x - P[j].y * P[j].y)) / (P[i].x * (P[j].y - P[k].y) + P[j].x * (P[k].y - P[i].y) + P[k].x * (P[i].y - P[j].y))); - C.y = 0.5 * ((P[i].x * (P[j].x * P[j].x + P[j].y * P[j].y - P[k].x * P[k].x - P[k].y * P[k].y) + P[j].x * (P[k].x * P[k].x + P[k].y * P[k].y - P[i].x * P[i].x - P[i].y * P[i].y) + P[k].x * (P[i].x * P[i].x + P[i].y * P[i].y - P[j].x * P[j].x - P[j].y * P[j].y)) / (P[i].x * (P[j].y - P[k].y) + P[j].x * (P[k].y - P[i].y) + P[k].x * (P[i].y - P[j].y))); - R = (LenghtLine(P[i], P[j]) * LenghtLine(P[j], P[k]) * LenghtLine(P[k], P[i])) / (4 * TriangleArea(P[i], P[j], P[k])); - if (!PointInCircle(P, C, R)) - { - continue; - } - if (R <= minR) - { - minR = R; - minC = C; - } - } - for (size_t i = 0; i < P.size() - 1; i++) - for (size_t j = i + 1; j < P.size(); j++) - { - C.x = (P[i].x + P[j].x) / 2; - C.y = (P[i].y + P[j].y) / 2; - R = LenghtLine(C, P[i]); - if (!PointInCircle(P, C, R)) - { - continue; - } - if (R <= minR) - { - minR = R; - minC = C; - } - } - cout << minC.x << " " << minC.y << endl; - return minR; -} - -void test() -{ - vector Pv(5); - Pv.push_back(Point(0, 0)); - Pv.push_back(Point(1, 3)); - Pv.push_back(Point(4, 1)); - Pv.push_back(Point(5, 4)); - Pv.push_back(Point(3, -2)); - cout << circle(Pv) << endl; -} - -void test2() -{ - vector Pv(4); - Pv.push_back(Point(0, 0)); - Pv.push_back(Point(0, 2)); - Pv.push_back(Point(2, 2)); - Pv.push_back(Point(2, 0)); - cout << circle(Pv) << endl; -} - -void test3() -{ - vector Pv(3); - Pv.push_back(Point(0.5, 1)); - Pv.push_back(Point(3.5, 3)); - Pv.push_back(Point(2.5, 0)); - cout << circle(Pv) << endl; -} -int main() -{ - test(); - cout << endl; - test2(); - cout << endl; - test3(); - return 0; -} diff --git a/others/smallest_circle.cpp b/others/smallest_circle.cpp new file mode 100644 index 000000000..9ee4353eb --- /dev/null +++ b/others/smallest_circle.cpp @@ -0,0 +1,205 @@ +/** + * @file + * @brief Get centre and radius of the + * [smallest circle](https://en.wikipedia.org/wiki/Smallest-circle_problem) + * that circumscribes given set of points. + * + * @see [other + * implementation](https://www.nayuki.io/page/smallest-enclosing-circle) + */ +#include +#include +#include + +/** Define a point */ +struct Point { + double x, /**< abscissa */ + y; /**< ordinate */ + + /** construct a point + * \param [in] a absicca (default = 0.0) + * \param [in] b ordinate (default = 0.0) + */ + explicit Point(double a = 0.f, double b = 0.f) { + x = a; + y = b; + } +}; + +/** Compute the Euclidian distance between two points \f$A\equiv(x_1,y_1)\f$ and + * \f$B\equiv(x_2,y_2)\f$ using the formula: + * \f[d=\sqrt{\left(x_1-x_2\right)^2+\left(y_1-y_2\right)^2}\f] + * + * \param [in] A point A + * \param [in] B point B + * \return ditance + */ +double LenghtLine(const Point &A, const Point &B) { + double dx = B.x - A.x; + double dy = B.y - A.y; + return std::sqrt((dx * dx) + (dy * dy)); +} + +/** + * Compute the area of triangle formed by three points using [Heron's + * formula](https://en.wikipedia.org/wiki/Heron%27s_formula). + * If the lengths of the sides of the triangle are \f$a,\,b,\,c\f$ and + * \f$s=\displaystyle\frac{a+b+c}{2}\f$ is the semi-perimeter then the area is + * given by \f[A=\sqrt{s(s-a)(s-b)(s-c)}\f] + * \param [in] A vertex A + * \param [in] B vertex B + * \param [in] C vertex C + * \returns area of triangle + */ +double TriangleArea(const Point &A, const Point &B, const Point &C) { + double a = LenghtLine(A, B); + double b = LenghtLine(B, C); + double c = LenghtLine(C, A); + double p = (a + b + c) / 2; + return std::sqrt(p * (p - a) * (p - b) * (p - c)); +} + +/** + * Check if a set of points lie within given circle. This is true if the + * distance of all the points from the centre of the circle is less than the + * radius of the circle + * \param [in] P set of points to check + * \param [in] Center coordinates to centre of the circle + * \param [in] R radius of the circle + * \returns True if P lies on or within the circle + * \returns False if P lies outside the circle + */ +bool PointInCircle(const std::vector &P, const Point &Center, double R) { + for (size_t i = 0; i < P.size(); i++) { + if (LenghtLine(P[i], Center) > R) + return false; + } + return true; +} + +/** + * Find the centre and radius of a circle enclosing a set of points.\n + * The function returns the radius of the circle and prints the coordinated of + * the centre of the circle. + * \param [in] P vector of points + * \returns radius of the circle + */ +double circle(const std::vector &P) { + double minR = INFINITY; + double R; + Point C; + Point minC; + + /* This code is invalid and does not give correct result for TEST 3 */ + // for each point in the list + for (size_t i = 0; i < P.size() - 2; i++) + // for every subsequent point in the list + for (size_t j = i + 1; j < P.size(); j++) + // for every subsequent point in the list + for (size_t k = j + 1; k < P.size(); k++) { + // here, we now have picked three points from the given set of + // points that we can use + // viz., P[i], P[j] and P[k] + C.x = -0.5 * ((P[i].y * (P[j].x * P[j].x + P[j].y * P[j].y - + P[k].x * P[k].x - P[k].y * P[k].y) + + P[j].y * (P[k].x * P[k].x + P[k].y * P[k].y - + P[i].x * P[i].x - P[i].y * P[i].y) + + P[k].y * (P[i].x * P[i].x + P[i].y * P[i].y - + P[j].x * P[j].x - P[j].y * P[j].y)) / + (P[i].x * (P[j].y - P[k].y) + + P[j].x * (P[k].y - P[i].y) + + P[k].x * (P[i].y - P[j].y))); + C.y = 0.5 * ((P[i].x * (P[j].x * P[j].x + P[j].y * P[j].y - + P[k].x * P[k].x - P[k].y * P[k].y) + + P[j].x * (P[k].x * P[k].x + P[k].y * P[k].y - + P[i].x * P[i].x - P[i].y * P[i].y) + + P[k].x * (P[i].x * P[i].x + P[i].y * P[i].y - + P[j].x * P[j].x - P[j].y * P[j].y)) / + (P[i].x * (P[j].y - P[k].y) + + P[j].x * (P[k].y - P[i].y) + + P[k].x * (P[i].y - P[j].y))); + R = (LenghtLine(P[i], P[j]) * LenghtLine(P[j], P[k]) * + LenghtLine(P[k], P[i])) / + (4 * TriangleArea(P[i], P[j], P[k])); + if (!PointInCircle(P, C, R)) { + continue; + } + if (R <= minR) { + minR = R; + minC = C; + } + } + + // for each point in the list + for (size_t i = 0; i < P.size() - 1; i++) + // for every subsequent point in the list + for (size_t j = i + 1; j < P.size(); j++) { + // check for diameterically opposite points + C.x = (P[i].x + P[j].x) / 2; + C.y = (P[i].y + P[j].y) / 2; + R = LenghtLine(C, P[i]); + if (!PointInCircle(P, C, R)) { + continue; + } + if (R <= minR) { + minR = R; + minC = C; + } + } + std::cout << minC.x << " " << minC.y << std::endl; + return minR; +} + +/** Test case: result should be: + * \n Circle with + * \n radius 3.318493136080724 + * \n centre at (3.0454545454545454, 1.3181818181818181) + */ +void test() { + std::vector Pv; + Pv.push_back(Point(0, 0)); + Pv.push_back(Point(5, 4)); + Pv.push_back(Point(1, 3)); + Pv.push_back(Point(4, 1)); + Pv.push_back(Point(3, -2)); + std::cout << circle(Pv) << std::endl; +} + +/** Test case: result should be: + * \n Circle with + * \n radius 1.4142135623730951 + * \n centre at (1.0, 1.0) + */ +void test2() { + std::vector Pv; + Pv.push_back(Point(0, 0)); + Pv.push_back(Point(0, 2)); + Pv.push_back(Point(2, 2)); + Pv.push_back(Point(2, 0)); + std::cout << circle(Pv) << std::endl; +} + +/** Test case: result should be: + * \n Circle with + * \n radius 1.821078397711709 + * \n centre at (2.142857142857143, 1.7857142857142856) + * @todo This test fails + */ +void test3() { + std::vector Pv; + Pv.push_back(Point(0.5, 1)); + Pv.push_back(Point(3.5, 3)); + Pv.push_back(Point(2.5, 0)); + Pv.push_back(Point(2, 1.5)); + std::cout << circle(Pv) << std::endl; +} + +/** Main program */ +int main() { + test(); + std::cout << std::endl; + test2(); + std::cout << std::endl; + test3(); + return 0; +} diff --git a/others/sparse_matrix.cpp b/others/sparse_matrix.cpp new file mode 100644 index 000000000..a358f0da4 --- /dev/null +++ b/others/sparse_matrix.cpp @@ -0,0 +1,48 @@ +/** @file + * A sparse matrix is a matrix which has number of zeroes greater than + * \f$\frac{m\times n}{2}\f$, where m and n are the dimensions of the matrix. + */ + +#include + +/** main function */ +int main() { + int m, n; + int counterZeros = 0; + + std::cout << "Enter dimensions of matrix (seperated with space): "; + std::cin >> m; + std::cin >> n; + + int **a = new int *[m]; + for (int i = 0; i < m; i++) a[i] = new int[n]; + + std::cout << "Enter matrix elements:"; + std::cout << "\n"; + + // reads the matrix from stdin + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + std::cout << "element? "; + std::cin >> a[i][j]; + } + } + + // counts the zero's + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + if (a[i][j] == 0) + counterZeros++; // Counting number of zeroes + } + } + + // makes sure the matrix is a sparse matrix + if (counterZeros > ((m * n) / 2)) // Checking for sparse matrix + std::cout << "Sparse matrix"; + else + std::cout << "Not a sparse matrix"; + + for (int i = 0; i < m; i++) delete[] a[i]; + delete[] a; + return 0; +} diff --git a/others/spiral_print.cpp b/others/spiral_print.cpp index e6e6899ef..02dc3183a 100644 --- a/others/spiral_print.cpp +++ b/others/spiral_print.cpp @@ -1,78 +1,81 @@ +/** + * @file + * @brief Print the elements of a matrix traversing it spirally + */ #include -using namespace std; - -void genArray(int a[][10], int r, int c) -{ +/** Arrange sequence of numbers from '1' in a matrix form + * \param [out] a matrix to fill + * \param [in] r number of rows + * \param [in] c number of columns + */ +void genArray(int **a, int r, int c) { int value = 1; - for (int i = 0; i < r; i++) - { - for (int j = 0; j < c; j++) - { + for (int i = 0; i < r; i++) { + for (int j = 0; j < c; j++) { a[i][j] = value; - cout << a[i][j] << " "; + std::cout << a[i][j] << " "; value++; } - cout << endl; + std::cout << std::endl; } } -void spiralPrint(int a[][10], int r, int c) -{ +/** Traverse the matrix spirally and print the sequence of elements + * \param [in] a matrix to read from + * \param [in] r number of rows + * \param [in] c number of columns + */ +void spiralPrint(int **a, int r, int c) { int startRow = 0, endRow = r - 1; int startCol = 0, endCol = c - 1; int cnt = 0; - while (startRow <= endRow && startCol <= endCol) - { - - ///Print start row - for (int i = startCol; i <= endCol; i++, cnt++) - { - cout << a[startRow][i] << " "; + while (startRow <= endRow && startCol <= endCol) { + /// Print start row + for (int i = startCol; i <= endCol; i++, cnt++) { + std::cout << a[startRow][i] << " "; } startRow++; - ///Print the end col - for (int i = startRow; i <= endRow; i++, cnt++) - { - cout << a[i][endCol] << " "; + /// Print the end col + for (int i = startRow; i <= endRow; i++, cnt++) { + std::cout << a[i][endCol] << " "; } endCol--; - ///Print the end row - if (cnt == r * c) - { + /// Print the end row + if (cnt == r * c) { break; } - for (int i = endCol; i >= startCol; i--, cnt++) - { - cout << a[endRow][i] << " "; + for (int i = endCol; i >= startCol; i--, cnt++) { + std::cout << a[endRow][i] << " "; } endRow--; - ///Print the start Col - if (cnt == r * c) - { + /// Print the start Col + if (cnt == r * c) { break; } - for (int i = endRow; i >= startRow; i--, cnt++) - { - cout << a[i][startCol] << " "; + for (int i = endRow; i >= startRow; i--, cnt++) { + std::cout << a[i][startCol] << " "; } startCol++; } } -int main() -{ - int a[10][10]; - +/** main function */ +int main() { int r, c; - cin >> r >> c; + std::cin >> r >> c; + int **a = new int *[r]; + for (int i = 0; i < r; i++) a[i] = new int[c]; + genArray(a, r, c); spiralPrint(a, r, c); + for (int i = 0; i < r; i++) delete[] a[i]; + delete[] a; return 0; } diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index 281446a2f..a3b8b0a44 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -1,31 +1,35 @@ -/* -This program is use to print the following pattern - ** - ** - **** - **** - ****** - ****** -******** -******** -where number of pairs line is given by user +/** + * @file +@brief This program is use to print the following pattern
+   \*\*
+   \*\*
+  \*\*\*\*
+  \*\*\*\*
+ \*\*\*\*\*\*
+ \*\*\*\*\*\*
+\*\*\*\*\*\*\*\*
+********
+where number of pairs line is given by user */ -#include +#include + +/** main function */ int main() { -int l, st = 2, x, r, z, n, sp; -std::cout << "enter Index "; -std::cin >> x; -z = x; -for (r = 1; r <= x; r++) { -z = z - 1; -for (n = 1; n <= 2; n++) { -for (sp = 1; sp <= z; sp++) { -std::cout << " "; + int l, st = 2, x, r, z, n, sp; + std::cout << "enter Index "; + std::cin >> x; + z = x; + for (r = 1; r <= x; r++) { + z = z - 1; + for (n = 1; n <= 2; n++) { + for (sp = 1; sp <= z; sp++) { + std::cout << " "; + } + for (l = 1; l <= st; l++) { + std::cout << "*"; + } + std::cout << std::endl; + } + st = st + 2; + } } -for (l = 1; l <= st; l++) { -std::cout << "*"; -} -std::cout <<"\n"; -} -st = st + 2; -}} diff --git a/others/tower_of_hanoi.cpp b/others/tower_of_hanoi.cpp new file mode 100644 index 000000000..323b2e424 --- /dev/null +++ b/others/tower_of_hanoi.cpp @@ -0,0 +1,85 @@ +/** + * @file + * @brief Solve the [Tower of + * Hanoi](https://en.wikipedia.org/wiki/Tower_of_Hanoi) problem. + */ +#include + +/** + * Define the state of tower + */ +struct tower { + //! Values in the tower + int values[10]; + //! top tower ID + int top; +}; + +/** Display the towers */ +void show(const struct tower *const F, const struct tower *const T, + const struct tower *const U) { + std::cout << "\n\n\tF : "; + for (int i = 0; i < F->top; i++) { + std::cout << F->values[i] << "\t"; + } + std::cout << "\n\tU : "; + for (int i = 0; i < U->top; i++) { + std::cout << U->values[i] << "\t"; + } + std::cout << "\n\tT : "; + for (int i = 0; i < T->top; i++) { + std::cout << T->values[i] << "\t"; + } +} + +/** Move one disc from one tower to another + * \param [in,out] From tower to move disk *from* + * \param [in,out] To tower to move disk *to* + */ +void mov(tower *From, tower *To) { + --From->top; + To->values[To->top] = From->values[From->top]; + ++To->top; +} + +/** + * Recursive algorithm to solve the puzzle + * \param [in] n starting number of disks + * \param [in,out] From tower to move disks from + * \param [in,out] Using temporary tower for the puzzle + * \param [in,out] To tower to move disk to + */ +void TH(int n, tower *From, tower *Using, tower *To) { + if (n == 1) { + mov(From, To); + show(From, To, Using); + } else { + TH(n - 1, From, To, Using); + mov(From, To); + show(From, To, Using); + TH(n - 1, Using, From, To); + } +} + +/** Main function */ +int main() { + struct tower F, U, T; + + F.top = 0; + U.top = 0; + T.top = 0; + + int no; + + std::cout << "\nEnter number of discs : "; + std::cin >> no; + + for (int i = no; i > 0; i--) { + F.values[F.top++] = i; + } + + show(&F, &T, &U); + TH(no, &F, &U, &T); + + return 0; +} diff --git a/others/vector_important_functions.cpp b/others/vector_important_functions.cpp index e0a70eeda..d23ff9c97 100644 --- a/others/vector_important_functions.cpp +++ b/others/vector_important_functions.cpp @@ -1,45 +1,43 @@ -// A C++ program to demonstrate working of sort(), -// reverse() +/** + * @file + * @brief A C++ program to demonstrate working of std::sort(), std::reverse() + */ #include #include +#include // For accumulate operation #include -#include //For accumulate operation -using namespace std; -int main() -{ - // Initializing vector with array values - int arr[] = {10, 20, 5, 23 ,42 , 15}; - int n = sizeof(arr)/sizeof(arr[0]); - vector vect(arr, arr+n); +/** Main function */ +int main() { + // Initializing vector with array values + int arr[] = {10, 20, 5, 23, 42, 15}; + int n = sizeof(arr) / sizeof(arr[0]); + std::vector vect(arr, arr + n); - cout << "Vector is: "; - for (int i=0; i -// calculates the probability of the events A or B for independent events - +/** + * calculates the probability of the independent events A or B for independent + * events + * \parama [in] A probability of event A + * \parama [in] B probability of event B + * \returns probability of A and B + */ double addition_rule_independent(double A, double B) { return (A + B) - (A * B); } -// calculates the probability of the events A or B for dependent events -// note that if value of B_given_A is unknown, use chainrule to find it - +/** Calculates the probability of the events A or B for dependent events + * note that if value of B_given_A is unknown, use chainrule to find it + * \parama [in] A probability of event A + * \parama [in] B probability of event B + * \parama [in] B_given_A probability of event B condition A + * \returns probability of A and B + */ double addition_rule_dependent(double A, double B, double B_given_A) { return (A + B) - (A * B_given_A); } +/** Main function */ int main() { double A = 0.5; double B = 0.25; double B_given_A = 0.05; - std::cout << "independent P(A or B) = " - << addition_rule_independent(A, B) << std::endl; + std::cout << "independent P(A or B) = " << addition_rule_independent(A, B) + << std::endl; std::cout << "dependent P(A or B) = " - << addition_rule_dependent(A, B, B_given_A) << std::endl; + << addition_rule_dependent(A, B, B_given_A) << std::endl; return 0; } diff --git a/probability/bayes_theorem.cpp b/probability/bayes_theorem.cpp index d30be6c9a..aaa557a94 100644 --- a/probability/bayes_theorem.cpp +++ b/probability/bayes_theorem.cpp @@ -1,24 +1,28 @@ +/** + * @file + * @brief [Bayes' theorem](https://en.wikipedia.org/wiki/Bayes%27_theorem) + * + * Bayes' theorem allows one to find \f$P(A|B)\f$ given \f$P(B|A)\f$ or + * \f$P(B|A)\f$ given \f$P(A|B)\f$ and \f$P(A)\f$ and \f$P(B)\f$.\n + * Note that \f$P(A|B)\f$ is read 'The probability of A given that the event B + * has occured'. + */ #include -// bayes' theorem > https://en.wikipedia.org/wiki/Bayes%27_theorem - -// bayes' theorem allows one to find P(A|B) given P(B|A) -// or P(B|A) given P(A|B) and P(A) and P(B) - -// note P(A|B) is read 'The probability of A given that the event B has occured' - -// returns P(A|B) - +/** returns P(A|B) + */ double bayes_AgivenB(double BgivenA, double A, double B) { return (BgivenA * A) / B; } -// returns P(B|A) - +/** returns P(B|A) + */ double bayes_BgivenA(double AgivenB, double A, double B) { return (AgivenB * B) / A; } +/** Main function + */ int main() { double A = 0.01; double B = 0.1; diff --git a/probability/binomial_dist.cpp b/probability/binomial_dist.cpp index b21a3e0fc..1f30c5048 100644 --- a/probability/binomial_dist.cpp +++ b/probability/binomial_dist.cpp @@ -1,81 +1,100 @@ -#include +/** + * @file + * @brief [Binomial + * distribution](https://en.wikipedia.org/wiki/Binomial_distribution) example + * + * The binomial distribution models the number of + * successes in a sequence of n independent events + * + * Summary of variables used: + * * n : number of trials + * * p : probability of success + * * x : desired successes + */ #include +#include -// the binomial distribution models the number of -// successes in a sequence of n independent events +/** finds the expected value of a binomial distribution + * \param [in] n + * \param [in] p + * \returns \f$\mu=np\f$ + */ +double binomial_expected(double n, double p) { return n * p; } -// n : number of trials -// p : probability of success -// x : desired successes - -// finds the expected value of a binomial distribution - -double binomial_expected(double n, double p) { - return n * p; -} - -// finds the variance of the binomial distribution - -double binomial_variance(double n, double p) { - return n * p * (1 - p); -} - -// finds the standard deviation of the binomial distribution +/** finds the variance of the binomial distribution + * \param [in] n + * \param [in] p + * \returns \f$\sigma^2 = n\cdot p\cdot (1-p)\f$ + */ +double binomial_variance(double n, double p) { return n * p * (1 - p); } +/** finds the standard deviation of the binomial distribution + * \param [in] n + * \param [in] p + * \returns \f$\sigma = \sqrt{\sigma^2} = \sqrt{n\cdot p\cdot (1-p)}\f$ + */ double binomial_standard_deviation(double n, double p) { - return sqrt(binomial_variance(n, p)); + return std::sqrt(binomial_variance(n, p)); } -// Computes n choose r -// n being the trials and r being the desired successes - +/** Computes n choose r + * \param [in] n + * \param [in] r + * \returns \f$\displaystyle {n\choose r} = + * \frac{n!}{r!(n-r)!} = \frac{n\times(n-1)\times(n-2)\times\cdots(n-r)}{r!} + * \f$ + */ double nCr(double n, double r) { double numerator = n; double denominator = r; - for (int i = n - 1 ; i >= ((n - r) + 1); i--) { + for (int i = n - 1; i >= ((n - r) + 1); i--) { numerator *= i; } - for (int i = 1; i < r ; i++) { + for (int i = 1; i < r; i++) { denominator *= i; } return numerator / denominator; } -// calculates the probability of exactly x successes - +/** calculates the probability of exactly x successes + * \returns \f$\displaystyle P(n,p,x) = {n\choose x} p^x (1-p)^{n-x}\f$ + */ double binomial_x_successes(double n, double p, double x) { - return nCr(n, x) * pow(p, x) * pow(1-p, n-x); + return nCr(n, x) * std::pow(p, x) * std::pow(1 - p, n - x); } -// calculates the probability of a result within a range (inclusive, inclusive) - -double binomial_range_successes( - double n, double p, double lower_bound, double upper_bound) { +/** calculates the probability of a result within a range (inclusive, inclusive) + * \returns \f$\displaystyle \left.P(n,p)\right|_{x_0}^{x_1} = + * \sum_{i=x_0}^{x_1} P(i) + * =\sum_{i=x_0}^{x_1} {n\choose i} p^i (1-p)^{n-i}\f$ + */ +double binomial_range_successes(double n, double p, double lower_bound, + double upper_bound) { double probability = 0; for (int i = lower_bound; i <= upper_bound; i++) { - probability += nCr(n, i) * pow(p, i) * pow(1 - p, n - i); + probability += nCr(n, i) * std::pow(p, i) * std::pow(1 - p, n - i); } return probability; } +/** main function */ int main() { - std::cout << "expected value : " - < +/** + * @file + * @brief [Poisson + * statistics](https://en.wikipedia.org/wiki/Poisson_distribution) + * + * The Poisson distribution counts how many + * events occur over a set time interval. + */ #include +#include -// The Poisson distribution counts how many -// events occur over a set time interval -// https://en.wikipedia.org/wiki/Poisson_distribution - -// calculate the events per unit time -// e.g 5 dollars every 2 mins = 5 / 2 = 2.5 - +/** + * poisson rate:\n + * calculate the events per unit time\n + * e.g 5 dollars every 2 mins = 5 / 2 = 2.5 + */ double poisson_rate(double events, double timeframe) { return events / timeframe; } -// calculate the expected value over a time -// e.g rate of 2.5 over 10 mins = 2.5 x 10 = 25 - -double poisson_expected(double rate, double time) { - return rate * time; -} - -// find the factorial of a given number +/** + * calculate the expected value over a time + * e.g rate of 2.5 over 10 mins = 2.5 x 10 = 25 + */ +double poisson_expected(double rate, double time) { return rate * time; } +/** + * Compute factorial of a given number + */ double fact(double x) { double x_fact = x; for (int i = x - 1; i > 0; i--) { @@ -33,14 +39,18 @@ double fact(double x) { return x_fact; } -// find the probability of x successes in a Poisson dist - +/** + * Find the probability of x successes in a Poisson dist. + * \f[p(\mu,x) = \frac{\mu^x e^{-\mu}}{x!}\f] + */ double poisson_x_successes(double expected, double x) { - return (pow(expected, x) * exp(-expected)) / fact(x); + return (std::pow(expected, x) * std::exp(-expected)) / fact(x); } -// probability of a success in range for Poisson dist (inclusive, inclusive) - +/** + * probability of a success in range for Poisson dist (inclusive, inclusive) + * \f[P = \sum_i p(\mu,i)\f] + */ double poisson_range_successes(double expected, double lower, double upper) { double probability = 0; for (int i = lower; i <= upper; i++) { @@ -49,6 +59,9 @@ double poisson_range_successes(double expected, double lower, double upper) { return probability; } +/** + * main function + */ int main() { double rate, expected; rate = poisson_rate(3, 1); @@ -57,10 +70,10 @@ int main() { expected = poisson_expected(rate, 2); std::cout << "Poisson expected : " << expected << std::endl; - std::cout << "Poisson 0 successes : " - < -using namespace std; -const int N = 1e6 + 5; -int a[N], bucket[N], cnt[N]; -int bucket_size; -struct query -{ - int l, r, i; -} q[N]; -int ans = 0; - -void add(int index) -{ - cnt[a[index]]++; - if (cnt[a[index]] == 1) - ans++; -} -void remove(int index) -{ - cnt[a[index]]--; - if (cnt[a[index]] == 0) - ans--; -} - -bool mycmp(query x, query y) -{ - if (x.l / bucket_size != y.l / bucket_size) - return x.l / bucket_size < y.l / bucket_size; - return x.r < y.r; -} - -int main() -{ - int n, t, i, j, k = 0; - scanf("%d", &n); - for (i = 0; i < n; i++) - scanf("%d", &a[i]); - bucket_size = ceil(sqrt(n)); - scanf("%d", &t); - for (i = 0; i < t; i++) - { - scanf("%d %d", &q[i].l, &q[i].r); - q[i].l--; - q[i].r--; - q[i].i = i; - } - sort(q, q + t, mycmp); - int left = 0, right = 0; - for (i = 0; i < t; i++) - { - int L = q[i].l, R = q[i].r; - while (left < L) - { - remove(left); - left++; - } - while (left > L) - { - add(left - 1); - left--; - } - while (right <= R) - { - add(right); - right++; - } - while (right > R + 1) - { - remove(right - 1); - right--; - } - bucket[q[i].i] = ans; - } - for (i = 0; i < t; i++) - printf("%d\n", bucket[i]); - return 0; -} diff --git a/range_queries/bit.cpp b/range_queries/bit.cpp index e5e36ed24..a1878705b 100644 --- a/range_queries/bit.cpp +++ b/range_queries/bit.cpp @@ -3,66 +3,50 @@ using namespace std; -class Bit -{ +class Bit { int n; vector bit; - inline int offset(int x) - { - return (x & (-x)); - } + inline int offset(int x) { return (x & (-x)); } - public: - - Bit(vector& arr) - { - n = arr.size(); - bit.assign(n + 1, 0); - for (int i = 0; i < n; ++i) - { - update(i, arr[i]); - } + public: + Bit(vector& arr) { + n = arr.size(); + bit.assign(n + 1, 0); + for (int i = 0; i < n; ++i) { + update(i, arr[i]); } - Bit(int x) - { + } + Bit(int x) { n = x; bit.assign(n + 1, 0); } - void update(int id, int val) - { + void update(int id, int val) { // Add val at id id++; - while (id <= n) - { + while (id <= n) { bit[id] += val; id += offset(id); } } - int sum(int id) - { + int sum(int id) { // Get prefix sum upto id. id++; int res = 0; - while (id > 0) - { + while (id > 0) { res += bit[id]; id -= offset(id); } return res; } - int sum_range(int l, int r) - { - return sum(r) - sum(l - 1); - } + int sum_range(int l, int r) { return sum(r) - sum(l - 1); } }; -int main() -{ +int main() { int n = 5; - vector arr = { 1, 2, 3, 4, 5 }; + vector arr = {1, 2, 3, 4, 5}; Bit x(arr); assert(x.sum_range(0, 0) == 1); @@ -72,5 +56,5 @@ int main() assert(x.sum_range(0, 0) == 6); assert(x.sum_range(0, 1) == 8); assert(x.sum_range(0, 2) == 11); - return 0; + return 0; } diff --git a/range_queries/FenwickTree.cpp b/range_queries/fenwicktree.cpp similarity index 70% rename from range_queries/FenwickTree.cpp rename to range_queries/fenwicktree.cpp index a4d1a02de..fb7cbaac4 100644 --- a/range_queries/FenwickTree.cpp +++ b/range_queries/fenwicktree.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace std; /** @@ -6,43 +6,41 @@ using namespace std; * twos complement works good on this * also using ` x - (x & (x - 1)) ` */ -#define lowbit(x) (x & (-x) ) +#define lowbit(x) (x & (-x)) const int maxn = 1e5 + 7; int tree[maxn] = {0}, - range; // segement of [1...range], notice it must be less than `maxn` + range; // segement of [1...range], notice it must be less than `maxn` void update(int x, int c) { - while(x <= range) { + while (x <= range) { tree[x] += c; x += lowbit(x); } } int query(int x) { int ans = 0; - while(x) { + while (x) { ans += tree[x]; x -= lowbit(x); } return ans; } -int query_segement(int l, int r) { - return query(r) - query(l - 1); -} +int query_segement(int l, int r) { return query(r) - query(l - 1); } int main() { cin >> range; - for(int i = 1; i <= range; i++) { + for (int i = 1; i <= range; i++) { int num; cin >> num; update(i, num); } int q; cin >> q; - while(q--) { + while (q--) { int op; cin >> op; - if(op == 0) { + if (op == 0) { int l, r; cin >> l >> r; cout << query_segement(l, r) << endl; diff --git a/range_queries/mo.cpp b/range_queries/mo.cpp new file mode 100644 index 000000000..d281ef077 --- /dev/null +++ b/range_queries/mo.cpp @@ -0,0 +1,64 @@ +#include +using namespace std; +const int N = 1e6 + 5; +int a[N], bucket[N], cnt[N]; +int bucket_size; +struct query { + int l, r, i; +} q[N]; +int ans = 0; + +void add(int index) { + cnt[a[index]]++; + if (cnt[a[index]] == 1) + ans++; +} +void remove(int index) { + cnt[a[index]]--; + if (cnt[a[index]] == 0) + ans--; +} + +bool mycmp(query x, query y) { + if (x.l / bucket_size != y.l / bucket_size) + return x.l / bucket_size < y.l / bucket_size; + return x.r < y.r; +} + +int main() { + int n, t, i, j, k = 0; + scanf("%d", &n); + for (i = 0; i < n; i++) scanf("%d", &a[i]); + bucket_size = ceil(sqrt(n)); + scanf("%d", &t); + for (i = 0; i < t; i++) { + scanf("%d %d", &q[i].l, &q[i].r); + q[i].l--; + q[i].r--; + q[i].i = i; + } + sort(q, q + t, mycmp); + int left = 0, right = 0; + for (i = 0; i < t; i++) { + int L = q[i].l, R = q[i].r; + while (left < L) { + remove(left); + left++; + } + while (left > L) { + add(left - 1); + left--; + } + while (right <= R) { + add(right); + right++; + } + while (right > R + 1) { + remove(right - 1); + right--; + } + bucket[q[i].i] = ans; + } + for (i = 0; i < t; i++) printf("%d\n", bucket[i]); + return 0; +} diff --git a/range_queries/segTree.cpp b/range_queries/segTree.cpp deleted file mode 100644 index ee81453e1..000000000 --- a/range_queries/segTree.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//#include -#incldue -#define MAX 4000000 -using namespace std; -typedef long long ll; -void ConsTree(ll arr[], ll segtree[], ll low, ll high, ll pos) -{ - if (low == high) - { - segtree[pos] = arr[low]; - return; - } - ll mid = (low + high) / 2; - ConsTree(arr, segtree, low, mid, 2 * pos + 1); - ConsTree(arr, segtree, mid + 1, high, 2 * pos + 2); - segtree[pos] = segtree[2 * pos + 1] + segtree[2 * pos + 2]; -} -ll query(ll segtree[], ll lazy[], ll qlow, ll qhigh, ll low, ll high, ll pos) -{ - if (low > high) - return 0; - if (qlow > high || qhigh < low) - return 0; - if (lazy[pos] != 0) - { - segtree[pos] += lazy[pos] * (high - low + 1); - if (low != high) - { - lazy[2 * pos + 1] += lazy[pos]; - lazy[2 * pos + 2] += lazy[pos]; - } - lazy[pos] = 0; - } - if (qlow <= low && qhigh >= high) - return segtree[pos]; - ll mid = (low + high) / 2; - return query(segtree, lazy, qlow, qhigh, low, mid, 2 * pos + 1) + query(segtree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2); -} -void update(ll segtree[], ll lazy[], ll start, ll end, ll delta, ll low, ll high, ll pos) -{ - if (low > high) - return; - if (lazy[pos] != 0) - { - segtree[pos] += lazy[pos] * (high - low + 1); - if (low != high) - { - lazy[2 * pos + 1] += lazy[pos]; - lazy[2 * pos + 2] += lazy[pos]; - } - lazy[pos] = 0; - } - if (start > high || end < low) - return; - if (start <= low && end >= high) - { - segtree[pos] += delta * (high - low + 1); - if (low != high) - { - lazy[2 * pos + 1] += delta; - lazy[2 * pos + 2] += delta; - } - return; - } - ll mid = (low + high) / 2; - update(segtree, lazy, start, end, delta, low, mid, 2 * pos + 1); - update(segtree, lazy, start, end, delta, mid + 1, high, 2 * pos + 2); - segtree[pos] = segtree[2 * pos + 1] + segtree[2 * pos + 2]; -} -int main() -{ - ll n, c; - scanf("%lld %lld", &n, &c); - ll arr[n] = {0}, p, q, v, choice; - ll segtree[MAX], lazy[MAX] = {0}; - ConsTree(arr, segtree, 0, n - 1, 0); - while (c--) - { - scanf("%lld", &choice); - if (choice == 0) - { - scanf("%lld %lld %lld", &p, &q, &v); - update(segtree, lazy, p - 1, q - 1, v, 0, n - 1, 0); - } - else - { - scanf("%lld %lld", &p, &q); - printf("%lld\n", query(segtree, lazy, p - 1, q - 1, 0, n - 1, 0)); - } - } - return 0; -} diff --git a/range_queries/segtree.cpp b/range_queries/segtree.cpp new file mode 100644 index 000000000..602b3fd95 --- /dev/null +++ b/range_queries/segtree.cpp @@ -0,0 +1,79 @@ +//#include +#incldue < iostream > +#define MAX 4000000 +using namespace std; +typedef long long ll; +void ConsTree(ll arr[], ll segtree[], ll low, ll high, ll pos) { + if (low == high) { + segtree[pos] = arr[low]; + return; + } + ll mid = (low + high) / 2; + ConsTree(arr, segtree, low, mid, 2 * pos + 1); + ConsTree(arr, segtree, mid + 1, high, 2 * pos + 2); + segtree[pos] = segtree[2 * pos + 1] + segtree[2 * pos + 2]; +} +ll query(ll segtree[], ll lazy[], ll qlow, ll qhigh, ll low, ll high, ll pos) { + if (low > high) + return 0; + if (qlow > high || qhigh < low) + return 0; + if (lazy[pos] != 0) { + segtree[pos] += lazy[pos] * (high - low + 1); + if (low != high) { + lazy[2 * pos + 1] += lazy[pos]; + lazy[2 * pos + 2] += lazy[pos]; + } + lazy[pos] = 0; + } + if (qlow <= low && qhigh >= high) + return segtree[pos]; + ll mid = (low + high) / 2; + return query(segtree, lazy, qlow, qhigh, low, mid, 2 * pos + 1) + + query(segtree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2); +} +void update(ll segtree[], ll lazy[], ll start, ll end, ll delta, ll low, + ll high, ll pos) { + if (low > high) + return; + if (lazy[pos] != 0) { + segtree[pos] += lazy[pos] * (high - low + 1); + if (low != high) { + lazy[2 * pos + 1] += lazy[pos]; + lazy[2 * pos + 2] += lazy[pos]; + } + lazy[pos] = 0; + } + if (start > high || end < low) + return; + if (start <= low && end >= high) { + segtree[pos] += delta * (high - low + 1); + if (low != high) { + lazy[2 * pos + 1] += delta; + lazy[2 * pos + 2] += delta; + } + return; + } + ll mid = (low + high) / 2; + update(segtree, lazy, start, end, delta, low, mid, 2 * pos + 1); + update(segtree, lazy, start, end, delta, mid + 1, high, 2 * pos + 2); + segtree[pos] = segtree[2 * pos + 1] + segtree[2 * pos + 2]; +} +int main() { + ll n, c; + scanf("%lld %lld", &n, &c); + ll arr[n] = {0}, p, q, v, choice; + ll segtree[MAX], lazy[MAX] = {0}; + ConsTree(arr, segtree, 0, n - 1, 0); + while (c--) { + scanf("%lld", &choice); + if (choice == 0) { + scanf("%lld %lld %lld", &p, &q, &v); + update(segtree, lazy, p - 1, q - 1, v, 0, n - 1, 0); + } else { + scanf("%lld %lld", &p, &q); + printf("%lld\n", query(segtree, lazy, p - 1, q - 1, 0, n - 1, 0)); + } + } + return 0; +} diff --git a/search/CMakeLists.txt b/search/CMakeLists.txt new file mode 100644 index 000000000..5fd1ae591 --- /dev/null +++ b/search/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/search") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/search/Interpolation Search.cpp b/search/Interpolation Search.cpp deleted file mode 100644 index f52ce4f4f..000000000 --- a/search/Interpolation Search.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -int InterpolationSearch(int A[], int n, int x) -{ - int low = 0; - int high = n - 1; - while (low <= high) - { - int mid = low + (((high - 1) * (x - A[low])) / (A[high] - A[low])); - if (x == A[mid]) - return mid; // Found x, return (exit) - else if (x < A[mid]) - high = mid - 1; // X lies before mid - else - low = mid + 1; // x lies after mid - } - return -1; -} - -int main() -{ - int A[] = {2, 4, 5, 7, 13, 14, 15, 23}; - int x = 17; - int index = InterpolationSearch(A, 8, x); // passed array A inside the InterpolationSearch function - if (index != -1) - std::cout << "Number " << x << " is at " << index; - else - std::cout << "Number " << x << " not found"; -} - -// randomly set x bcoz array was defined by us , therefore not reasonable for asking input. -// We could have asked for input if array elements were inputed by the user. diff --git a/search/Linear Search.cpp b/search/Linear Search.cpp deleted file mode 100644 index 97e820437..000000000 --- a/search/Linear Search.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -using namespace std; - -int LinearSearch(int *array, int size, int key) -{ - for (int i = 0; i < size; ++i) - { - if (array[i] == key) - { - return i; - } - } - - return -1; -} - -int main() -{ - int size; - cout << "\nEnter the size of the Array : "; - cin >> size; - - int array[size]; - int key; - - //Input array - cout << "\nEnter the Array of " << size << " numbers : "; - for (int i = 0; i < size; i++) - { - cin >> array[i]; - } - - cout << "\nEnter the number to be searched : "; - cin >> key; - - int index = LinearSearch(array, size, key); - if (index != -1) - { - cout << "\nNumber found at index : " << index; - } - else - { - cout << "\nNot found"; - } - - return 0; -} diff --git a/search/binary_search.cpp b/search/binary_search.cpp index 9933c9816..66da31d7f 100644 --- a/search/binary_search.cpp +++ b/search/binary_search.cpp @@ -1,34 +1,56 @@ +/** + * @file + * @brief [Binary search + * algorithm](https://en.wikipedia.org/wiki/Binary_search_algorithm) + */ #include -// binary_search function -int binary_search(int a[], int l, int r, int key) { + +/** binary_search function + * \param [in] a array to sort + * \param [in] r right hand limit = \f$n-1\f$ + * \param [in] key value to find + * \returns index if T is found + * \return -1 if T is not found + */ +int binary_search(int a[], int r, int key) { + int l = 0; + while (l <= r) { - int m = l + (r - l) / 2; - if (key == a[m]) - return m; - else if (key < a[m]) - r = m - 1; - else - l = m + 1; - } - return -1; - } + int m = l + (r - l) / 2; + if (key == a[m]) + return m; + else if (key < a[m]) + r = m - 1; + else + l = m + 1; + } + return -1; +} + +/** main function */ int main(int argc, char const* argv[]) { int n, key; std::cout << "Enter size of array: "; std::cin >> n; std::cout << "Enter array elements: "; + int* a = new int[n]; -// this loop use for store value in Array + + // this loop use for store value in Array for (int i = 0; i < n; i++) { std::cin >> a[i]; - } + } + std::cout << "Enter search key: "; std::cin >> key; -// this is use for find value in given array - int res = binary_search(a, 0, n - 1, key); + + // this is use for find value in given array + int res = binary_search(a, n - 1, key); if (res != -1) - std::cout << key << " found at index " << res << std::endl; + std::cout << key << " found at index " << res << std::endl; else - std::cout << key << " not found" << std::endl; + std::cout << key << " not found" << std::endl; + + delete[] a; return 0; } diff --git a/search/exponential_search.cpp b/search/exponential_search.cpp index b8343fa02..f57cbf96b 100644 --- a/search/exponential_search.cpp +++ b/search/exponential_search.cpp @@ -1,56 +1,84 @@ -// Copyright 2020 Divide-et-impera-11 -#include +/** + * \file + * \brief [Exponential search + * algorithm](https://en.wikipedia.org/wiki/Exponential_search) + * \copyright 2020 Divide-et-impera-11 + * + * The algorithm try to search the range where the key should be. + * If it has been found we do a binary search there. + * The range of the search grows by exponential every time. + * If the key is larger than the last element of array, the start of + * block(block_front) will be equal to the end of block(block_size) and the + * algorithm return null ponter, every other cases the algoritm return fom the + * loop. + */ +#include +#include #include -#include -using namespaces std; -// Binary Search Algorithm(use by struzik algorithm) -// Time Complexity O(log n) where 'n' is the number of elements -// Worst Time Complexity O(log n) -// Best Time Complexity Ω(1) -// Space Complexity O(1) -// Auxiliary Space Complexity O(1) -template inline Type* binary_s(Type *array, size_t size, Type key) { -int32_t lower_index(0), upper_index(size - 1), middle_index; -while (lower_index <= upper_index) { - middle_index = floor((lower_index + upper_index) / 2); - if (*(array + middle_index) < key) lower_index = (middle_index + 1); - else if (*(array + middle_index) > key)upper_index = (middle_index - 1); - else return (array + middle_index); - } -return nullptr; +#ifdef _MSC_VER +#include // use for MS Visual C++ +#else +#include // for all other compilers +#endif + +/** Binary Search Algorithm (used by ::struzik_search)\n + * * Time Complexity O(log n) where 'n' is the number of elements + * * Worst Time Complexity O(log n) + * * Best Time Complexity Ω(1) + * * Space Complexity O(1) + * * Auxiliary Space Complexity O(1) + * \returns pointer to value in the array + * \returns `nullptr` if value not found + */ +template +inline Type* binary_s(Type* array, size_t size, Type key) { + int32_t lower_index(0), upper_index(size - 1), middle_index; + + while (lower_index <= upper_index) { + middle_index = std::floor((lower_index + upper_index) / 2); + + if (*(array + middle_index) < key) + lower_index = (middle_index + 1); + else if (*(array + middle_index) > key) + upper_index = (middle_index - 1); + else + return (array + middle_index); + } + + return nullptr; } -// Struzik Search Algorithm(Exponential) -// Time Complexity O(log i)where i is the position of search key in the list -// Worst Time Complexity O(log i) -// Best Time Complexity Ω(1) -// Space Complexity O(1) -// Auxiliary Space Complexity O(1) -/* Tha algorithm try to search the range where the key should be. -If it has been found we do a binary search there. -The range of the search grows by exponential every time. -If the key is larger than the last element of array, -the start of block(block_front) will be equal to the end of block(block_size) -and the algorithm return null ponter, -every other cases the algoritm return fom the loop. */ -template Type* struzik_search(Type* array, size_t size, Type key) { - uint32_t block_front(0), block_size = size == 0 ? 0 : 1; - while (block_front != block_size) { + +/** Struzik Search Algorithm(Exponential) + * * Time Complexity O(log i) where i is the position of search key in the list + * * Worst Time Complexity O(log i) + * * Best Time Complexity Ω(1) + * * Space Complexity O(1) + * * Auxiliary Space Complexity O(1) + */ +template +Type* struzik_search(Type* array, size_t size, Type key) { + uint32_t block_front(0), block_size = size == 0 ? 0 : 1; + while (block_front != block_size) { if (*(array + block_size - 1) < key) { - block_front = block_size; - (block_size * 2 - 1 < size) ? (block_size *= 2) : block_size = size; - continue; + block_front = block_size; + (block_size * 2 - 1 < size) ? (block_size *= 2) : block_size = size; + continue; } - return binary_s(array + block_front, (block_size - block_front), key); - } -return nullptr; + return binary_s(array + block_front, (block_size - block_front), + key); + } + return nullptr; } + +/** Main function */ int main() { -// TEST CASES -int *sorted_array = new int[7]{7, 10, 15, 23, 70, 105, 203}; -assert(struzik_search(sorted_array, 7, 0) == nullptr); -assert(struzik_search(sorted_array, 7, 1000) == nullptr); -assert(struzik_search(sorted_array, 7, 50) == nullptr); -assert(struzik_search(sorted_array, 7, 7) == sorted_array); -// TEST CASES -return 0; + // TEST CASES + int* sorted_array = new int[7]{7, 10, 15, 23, 70, 105, 203}; + assert(struzik_search(sorted_array, 7, 0) == nullptr); + assert(struzik_search(sorted_array, 7, 1000) == nullptr); + assert(struzik_search(sorted_array, 7, 50) == nullptr); + assert(struzik_search(sorted_array, 7, 7) == sorted_array); + // TEST CASES + delete[] sorted_array; + return 0; } diff --git a/search/hash_search.cpp b/search/hash_search.cpp index 94d87b58a..6e4caffc3 100644 --- a/search/hash_search.cpp +++ b/search/hash_search.cpp @@ -1,100 +1,139 @@ -// Copyright 2020 Arctic2333 -#include -#include -#define MAX 6 // Determines how much data -# define HASHMAX 5 // Determines the length of the hash table /** - * Hash Search Algorithm - * Best Time Complexity Ω(1) - * In this algorithm, we use the method of division and reservation remainder to construct the hash function, - * and use the method of chain address to solve the conflict, that is, we link a chain list after the data, - * and store all the records whose keywords are synonyms in the same linear chain list. */ -int data[MAX] = { 1, 10, 15, 5, 8, 7}; // test data + * \file + * \brief Hash Search Algorithm - Best Time Complexity Ω(1) + * + * \copyright 2020 Arctic2333 + * + * In this algorithm, we use the method of division and reservation remainder to + * construct the hash function, and use the method of chain address to solve the + * conflict, that is, we link a chain list after the data, and store all the + * records whose keywords are synonyms in the same linear chain list. + * + * @warning This program is only for educational purposes. It has serious flaws + * in implementation with regards to memory management resulting in large + * amounts of memory leaks. + * @todo fix the program for memory leaks and better structure in C++ and not C + * fashion + */ +#include +#include + +#define MAX 6 ///< Determines how much data +#define HASHMAX 5 ///< Determines the length of the hash table + +int data[MAX] = {1, 10, 15, 5, 8, 7}; //!< test data + +/** + * a one-way linked list + */ typedef struct list { - int key; - struct list * next; -} -node, * link; -node hashtab[HASHMAX]; -int counter = 1; -/* int h(int key) + int key; //!< key value for node + struct list* next; //!< pointer to next link in the chain +} node, /**< define node as one item list */ + *link; ///< pointer to nodes + +node hashtab[HASHMAX]; ///< array of nodes + +// int counter = 1; + +/** * Mode of hash detection : - * Division method */ -int h(int key) { - return key % HASHMAX; -} -/* void create_list(int key) + * Division method + * \param [in] key to hash + * \returns hash value for `key` + */ +int h(int key) { return key % HASHMAX; } + +/** * The same after the remainder will be added after the same hash header * To avoid conflict, zipper method is used - * Insert elements into the linked list in the header */ + * Insert elements into the linked list in the header + * \param [in] key key to add to list + * \warning dynamic memory allocated to `n` never gets freed. + * \todo fix memory leak + */ void create_list(int key) { // Construct hash table link p, n; int index; - n = (link) malloc(sizeof(node)); - n -> key = key; - n -> next = NULL; + n = (link)malloc(sizeof(node)); + n->key = key; + n->next = NULL; index = h(key); p = hashtab[index].next; if (p != NULL) { - n -> next = p; + n->next = p; hashtab[index].next = n; } else { - hashtab[index].next = n; } + hashtab[index].next = n; + } } -/* int hash_search(int key) - * Input the key to be searched, and get the hash header position through the H (int key) function, - * then one-dimensional linear search. - * If found @return element depth and number of searches - * If not found @return -1 */ -int hash_search(int key) { // Hash lookup function + +/** + * Input the key to be searched, and get the hash header position through the H + * (int key) function, then one-dimensional linear search. If found @return + * element depth and number of searches If not found @return -1 + */ +int hash_search(int key, int* counter) { // Hash lookup function link pointer; int index; - counter = 0; + + *counter = 0; index = h(key); pointer = hashtab[index].next; - printf("data[%d]:", index); + + std::cout << "data[" << index << "]:"; + while (pointer != NULL) { - counter++; - printf("data[%d]:", pointer -> key); - if (pointer -> key == key) + counter[0]++; + std::cout << "data[" << pointer->key << "]:"; + if (pointer->key == key) return 1; else - pointer = pointer -> next; + pointer = pointer->next; } + return 0; } + +/** main function */ int main() { link p; - int key, index, i; // Key is the value to be found + int key, index, i, counter; // Key is the value to be found index = 0; + // You can write the input mode here while (index < MAX) { // Construct hash table create_list(data[index]); index++; } + for (i = 0; i < HASHMAX; i++) { // Output hash table - printf("hashtab [%d]", i); - printf("\n"); + std::cout << "hashtab [" << i << "]\n"; + p = hashtab[i].next; + while (p != NULL) { - printf("please int key:"); - if (p -> key > 0) - printf("[%d]", p -> key); - p = p -> next; + std::cout << "please int key:"; + if (p->key > 0) + std::cout << "[" << p->key << "]"; + p = p->next; } - printf("\n"); + std::cout << std::endl; } + while (key != -1) { // You can write the input mode here // test key = 10 key = 10; - if (hash_search(key)) - printf("search time = %d\n", counter); + if (hash_search(key, &counter)) + std::cout << "search time = " << counter << std::endl; else - printf("no found!\n"); + std::cout << "no found!\n"; key = -1; // Exit test - /* The test sample is returned as: data[0]:data[5]:data[15]:data[10]:search time = 3 - * The search is successful. There are 10 in this set of data */ + /* The test sample is returned as: + * data[0]:data[5]:data[15]:data[10]:search time = 3 The search is + * successful. There are 10 in this set of data */ } + return 0; } diff --git a/search/interpolation_search.cpp b/search/interpolation_search.cpp index afa9e7c50..4339dc366 100644 --- a/search/interpolation_search.cpp +++ b/search/interpolation_search.cpp @@ -1,36 +1,61 @@ -#include +/** + * \file + * \brief [Interpolation + * search](https://en.wikipedia.org/wiki/Interpolation_search) algorithm + */ +#include -// function to search the value in an array using interpolation search -int search(int arr[], int value, int len) { - int low = 0, high, mid; - high = len-1; - while (arr[low] <= value && arr[high] >= value) { - mid = (low + ((value-arr[low])*(high-low)) / (arr[high]-arr[low])); - if (arr[mid] > value) - high = mid-1; - else if (arr[mid] < value) - low = mid+1; - else - return mid; - } - if (arr[low] == value) - return low; - return 0; +/** function to search the value in an array using interpolation search + * \param [in] arr array to search in + * \param [in] value value to search for + * \param [in] len length of array + * \returns index where the value is found + * \returns 0 if not found + */ +int interpolation_search(int arr[], int value, int len) { + int low = 0, high, mid; + high = len - 1; + + while (arr[low] <= value && arr[high] >= value) { + mid = (low + + ((value - arr[low]) * (high - low)) / (arr[high] - arr[low])); + if (arr[mid] > value) + high = mid - 1; + else if (arr[mid] < value) + low = mid + 1; + else + return mid; + } + + if (arr[low] == value) + return low; + + return -1; } +/** main function */ int main() { - int n, value, array[100], re; - std::cout << "Enter the size of array(less than 100) : "; - std::cin >> n; - std::cout << "array in ascending (increasing) order : " << std::endl; - for (int i=0; i < n; i++) - std::cin >> array[i]; - std::cout << "Enter the value you want to search : "; - std::cin >> value; - re = search(array, value, n); - if (re == 0) - std::cout << "Entered value is not in the array" << std::endl; - else - std::cout << "The value is at the position " << re << std::endl; - return 0; - } + int n, value, re; + + std::cout << "Enter the size of array(less than 100) : "; + std::cin >> n; + + int *array = new int[n]; + + std::cout << "array in ascending (increasing) order : " << std::endl; + + for (int i = 0; i < n; i++) std::cin >> array[i]; + + std::cout << "Enter the value you want to search : "; + std::cin >> value; + + re = interpolation_search(array, value, n); + + if (re == -1) + std::cout << "Entered value is not in the array" << std::endl; + else + std::cout << "The value is at the position " << re << std::endl; + + delete[] array; + return 0; +} diff --git a/search/interpolation_search2.cpp b/search/interpolation_search2.cpp new file mode 100644 index 000000000..93fa6cd83 --- /dev/null +++ b/search/interpolation_search2.cpp @@ -0,0 +1,46 @@ +/** + * \file + * \brief [Interpolation + * search](https://en.wikipedia.org/wiki/Interpolation_search) algorithm + */ +#include + +/** function to search the value in an array using interpolation search + * \param [in] arr array to search in + * \param [in] value value to search for + * \param [in] len length of array + * \returns index where the value is found + * \returns -1 if not found + */ +int InterpolationSearch(int A[], int n, int x) { + int low = 0; + int high = n - 1; + while (low <= high) { + int mid = low + (((high - 1) * (x - A[low])) / (A[high] - A[low])); + if (x == A[mid]) + return mid; // Found x, return (exit) + else if (x < A[mid]) + high = mid - 1; // X lies before mid + else + low = mid + 1; // x lies after mid + } + + return -1; +} + +/** main function */ +int main() { + int A[] = {2, 4, 5, 7, 13, 14, 15, 23}; + int x = 17; + + ///< passed array A inside the InterpolationSearch function + int index = InterpolationSearch(A, 8, x); + if (index < 0) + std::cout << "Number " << x << " not found" << std::endl; + else + std::cout << "Number " << x << " is at " << index << std::endl; +} + +// randomly set x bcoz array was defined by us , therefore not reasonable for +// asking input. We could have asked for input if array elements were inputed by +// the user. diff --git a/search/jump_search.cpp b/search/jump_search.cpp index 0ee7e4e00..f7b100a4e 100644 --- a/search/jump_search.cpp +++ b/search/jump_search.cpp @@ -1,33 +1,36 @@ -// C++ program to implement Jump Search +/** + * \file + * \brief C++ program to implement [Jump + * Search](https://en.wikipedia.org/wiki/Jump_search) + */ +#include +#include +#include -#include -using namespace std; - -int jumpSearch(int arr[], int x, int n) -{ +/** jump search implementation + */ +int jumpSearch(int arr[], int x, int n) { // Finding block size to be jumped - int step = sqrt(n); + int step = std::sqrt(n); // Finding the block where element is // present (if it is present) int prev = 0; - while (arr[min(step, n)-1] < x) - { + while (arr[std::min(step, n) - 1] < x) { prev = step; - step += sqrt(n); + step += std::sqrt(n); if (prev >= n) return -1; } // Doing a linear search for x in block // beginning with prev. - while (arr[prev] < x) - { + while (arr[prev] < x) { prev++; // If we reached next block or end of // array, element is not present. - if (prev == min(step, n)) + if (prev == std::min(step, n)) return -1; } // If element is found @@ -38,10 +41,8 @@ int jumpSearch(int arr[], int x, int n) } // Driver program to test function -int main() -{ - int arr[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, - 34, 55, 89, 144, 233, 377, 610 }; +int main() { + int arr[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610}; int x = 55; int n = sizeof(arr) / sizeof(arr[0]); @@ -49,6 +50,6 @@ int main() int index = jumpSearch(arr, x, n); // Print the index where 'x' is located - cout << "\nNumber " << x << " is at index " << index; + std::cout << "\nNumber " << x << " is at index " << index; return 0; } diff --git a/search/linear_search.cpp b/search/linear_search.cpp new file mode 100644 index 000000000..142506951 --- /dev/null +++ b/search/linear_search.cpp @@ -0,0 +1,53 @@ +/** + * \file + * \brief [Linear search + * algorithm](https://en.wikipedia.org/wiki/Linear_search) + */ +#include + +/** + * Algorithm implementation + * \param [in] array array to search in + * \param [in] size length of array + * \param [in] key key value to search for + * \returns index where the key-value occurs in the array + * \returns -1 if key-value not found + */ +int LinearSearch(int *array, int size, int key) { + for (int i = 0; i < size; ++i) { + if (array[i] == key) { + return i; + } + } + + return -1; +} + +/** main function */ +int main() { + int size; + std::cout << "\nEnter the size of the Array : "; + std::cin >> size; + + int *array = new int[size]; + int key; + + // Input array + std::cout << "\nEnter the Array of " << size << " numbers : "; + for (int i = 0; i < size; i++) { + std::cin >> array[i]; + } + + std::cout << "\nEnter the number to be searched : "; + std::cin >> key; + + int index = LinearSearch(array, size, key); + if (index != -1) { + std::cout << "\nNumber found at index : " << index; + } else { + std::cout << "\nNot found"; + } + + delete[] array; + return 0; +} diff --git a/search/median_search.cpp b/search/median_search.cpp index be95b599f..7379cad26 100644 --- a/search/median_search.cpp +++ b/search/median_search.cpp @@ -1,72 +1,78 @@ -#include -#include -#include -#include -#include -#include -#include -using namespace std; -vectorv; -vectors1; -vectors2; -vectors3; +/** + * \file + * \brief [Median search](https://en.wikipedia.org/wiki/Median_search) algorithm + * \warning This core is erroneous and gives invorrect answers. Tested using + * cases from [here](https://brilliant.org/wiki/median-finding-algorithm/) + * \ingroup median search + * \{ + */ +#include +#include +#include + +/** + * @todo add documentation + */ template -void comp(X x) -{ - if(s1.size()>=x && s1.size()+s2.size()x) - { - sort(s1.begin(),s1.end()); - cout<x) - { - sort(s3.begin(),s3.end()); - cout< *s1, std::vector *s2, + std::vector *s3) { + if (s1->size() >= x && s1->size() + s2->size() < x) { + std::cout << (*s2)[0] << " is the " << x + 1 << "th element from front"; + } else if (s1->size() > x) { + std::sort(s1->begin(), s1->end()); + std::cout << (*s1)[x] << " is the " << x + 1 << "th element from front"; + } else if (s1->size() + s2->size() <= x && s3->size() > x) { + std::sort(s3->begin(), s3->end()); + std::cout << (*s3)[x - s1->size() - s2->size()] << " is the " << x + 1 + << "th element from front"; + } else { + std::cout << x + 1 << " is invalid location"; } } -int main() -{ - for(int i=0;i<1000;i++) - { - v.push_back(rand()%1000); - } - for(int r:v) - { - cout<>x; - comp(x-1); + std::cout << "enter the no. to be searched form begining:- "; + std::cin >> x; + comp(x - 1, &s1, &s2, &s3); + return 0; } +/// } diff --git a/search/searching.cpp b/search/searching.cpp deleted file mode 100644 index 6a9dcac7d..000000000 --- a/search/searching.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include - -using namespace std; -char paragraph; - -int main() -{ - string paragraph; - cout << "Please enter your paragraph: \n"; - getline(cin, paragraph); - cout << "\nHello, your paragraph is:\n " << paragraph << "!\n"; - cout << "\nThe size of your paragraph = " << paragraph.size() << " characters. \n\n"; - - if (paragraph.empty()) - { - cout << "\nThe paragraph is empty" << endl; - } - else - { - while (true) - { - string word; - cout << "Please enter the word you are searching for: "; - getline(cin, word); - cout << "Hello, your word is " << word << "!\n"; - if (paragraph.find(word) == string::npos) - { - cout << word << " does not exist in the sentence" << endl; - } - else - { - cout << "The word " << word << " is now found at location " << paragraph.find(word) << endl - << endl; - } - system("pause"); - } - } -} diff --git a/search/ternary_search.cpp b/search/ternary_search.cpp index 4cb8d19d9..73b89da7a 100644 --- a/search/ternary_search.cpp +++ b/search/ternary_search.cpp @@ -1,128 +1,140 @@ -/* +/** + * \file + * \brief [Ternary search](https://en.wikipedia.org/wiki/Ternary_search) + * algorithm + * * This is a divide and conquer algorithm. * It does this by dividing the search space by 3 parts and * using its property (usually monotonic property) to find * the desired index. - * - * Time Complexity : O(log3 n) - * Space Complexity : O(1) (without the array) + * + * * Time Complexity : O(log3 n) + * * Space Complexity : O(1) (without the array) */ #include -using namespace std; -/* - * The absolutePrecision can be modified to fit preference but +/** + * The absolutePrecision can be modified to fit preference but * it is recommended to not go lower than 10 due to errors that * may occur. - * + */ +#define absolutePrecision 10 +/** * The value of _target should be decided or can be decided later * by using the variable of the function. */ - #define _target 10 -#define absolutePrecision 10 -#define MAX 10000000 -int N = 21; -int A[MAX] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 10}; +#define MAX 10000000 ///< Maximum length of array -/* +/** * get_input function is to receive input from standard IO + * @todo @christianbender Get input from STDIO or write input to memory as done + * above. */ -void get_input() -{ - // TODO: Get input from STDIO or write input to memory as done above. +void get_input() {} + +/** + * This is the iterative method of the ternary search which returns the index of + * the element. + * \param[in] left lower interval limit + * \param[in] right upper interval limit + * \param[in] A array to search in + * \param[in] target value to search for + * \returns index where the target value was found + * \returns -1 if target value not found + */ +int it_ternary_search(int left, int right, int A[], int target) { + while (1) { + if (left < right) { + if (right - left < absolutePrecision) { + for (int i = left; i <= right; i++) + if (A[i] == target) + return i; + + return -1; + } + + int oneThird = (left + right) / 3 + 1; + int twoThird = (left + right) * 2 / 3 + 1; + + if (A[oneThird] == target) + return oneThird; + else if (A[twoThird] == target) + return twoThird; + + else if (target > A[twoThird]) + left = twoThird + 1; + else if (target < A[oneThird]) + right = oneThird - 1; + + else + left = oneThird + 1, right = twoThird - 1; + } else { + return -1; + } + } } -/* - * This is the iterative method of the ternary search which returns the index of the element. +/** + * This is the recursive method of the ternary search which returns the index of + * the element. + * \param[in] left lower interval limit + * \param[in] right upper interval limit + * \param[in] A array to search in + * \param[in] target value to search for + * \returns index where the target value was found + * \returns -1 if target value not found */ -int it_ternary_search(int left, int right, int A[], int target) -{ - while (1) - { - if (left < right) - { - if (right - left < absolutePrecision) - { - for (int i = left; i <= right; i++) - if (A[i] == target) - return i; +int rec_ternary_search(int left, int right, int A[], int target) { + if (left < right) { + if (right - left < absolutePrecision) { + for (int i = left; i <= right; i++) + if (A[i] == target) + return i; + return -1; + } + + int oneThird = (left + right) / 3 + 1; + int twoThird = (left + right) * 2 / 3 + 1; + + if (A[oneThird] == target) + return oneThird; + if (A[twoThird] == target) + return twoThird; + + if (target < A[oneThird]) + return rec_ternary_search(left, oneThird - 1, A, target); + if (target > A[twoThird]) + return rec_ternary_search(twoThird + 1, right, A, target); + + return rec_ternary_search(oneThird + 1, twoThird - 1, A, target); + } else { return -1; - } - - int oneThird = (left + right) / 3 + 1; - int twoThird = (left + right) * 2 / 3 + 1; - - if (A[oneThird] == target) - return oneThird; - else if (A[twoThird] == target) - return twoThird; - - else if (target > A[twoThird]) - left = twoThird + 1; - else if (target < A[oneThird]) - right = oneThird - 1; - - else - left = oneThird + 1, right = twoThird - 1; } - else - return -1; - } } -/* - * This is the recursive method of the ternary search which returns the index of the element. - */ -int rec_ternary_search(int left, int right, int A[], int target) -{ - if (left < right) - { - if (right - left < absolutePrecision) - { - for (int i = left; i <= right; i++) - if (A[i] == target) - return i; - - return -1; - } - - int oneThird = (left + right) / 3 + 1; - int twoThird = (left + right) * 2 / 3 + 1; - - if (A[oneThird] == target) - return oneThird; - if (A[twoThird] == target) - return twoThird; - - if (target < A[oneThird]) - return rec_ternary_search(left, oneThird - 1, A, target); - if (target > A[twoThird]) - return rec_ternary_search(twoThird + 1, right, A, target); - - return rec_ternary_search(oneThird + 1, twoThird - 1, A, target); - } - else - return -1; -} - -/* +/** * ternary_search is a template function - * You could either use it_ternary_search or rec_ternary_search according to preference. + * You could either use it_ternary_search or rec_ternary_search according to + * preference. + * \param [in] N length of array + * \param[in] A array to search in + * \param[in] target value to search for */ -void ternary_search(int N, int A[], int target) -{ - cout << it_ternary_search(0, N - 1, A, target) << '\t'; - cout << rec_ternary_search(0, N - 1, A, target) << '\t'; - cout << '\n'; +void ternary_search(int N, int A[], int target) { + std::cout << it_ternary_search(0, N - 1, A, target) << '\t'; + std::cout << rec_ternary_search(0, N - 1, A, target) << '\t'; + std::cout << std::endl; } -int main() -{ - get_input(); - ternary_search(N, A, _target); - return 0; +/** Main function */ +int main() { + int N = 21; + int A[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 10}; + get_input(); + ternary_search(N, A, _target); + return 0; } diff --git a/search/text_search.cpp b/search/text_search.cpp new file mode 100644 index 000000000..ee66a506a --- /dev/null +++ b/search/text_search.cpp @@ -0,0 +1,42 @@ +/** + * \file + * \brief Search for words in a long textual paragraph. + */ +#include +#include +#ifdef _MSC_VER +#include // required for MS Visual C++ +#else +#include +#endif + +/** Main function + */ +int main() { + std::string paragraph; + std::cout << "Please enter your paragraph: \n"; + std::getline(std::cin, paragraph); + std::cout << "\nHello, your paragraph is:\n " << paragraph << "!\n"; + std::cout << "\nThe size of your paragraph = " << paragraph.size() + << " characters. \n\n"; + + if (paragraph.empty()) { + std::cout << "\nThe paragraph is empty" << std::endl; + } else { + while (true) { + std::string word; + std::cout << "Please enter the word you are searching for: "; + std::getline(std::cin, word); + std::cout << "Hello, your word is " << word << "!\n"; + if (paragraph.find(word) == std::string::npos) { + std::cout << word << " does not exist in the sentence" + << std::endl; + } else { + std::cout << "The word " << word << " is now found at location " + << paragraph.find(word) << std::endl + << std::endl; + } + std::cin.get(); + } + } +} diff --git a/sorting/BeadSort.cpp b/sorting/BeadSort.cpp deleted file mode 100644 index c8e27b250..000000000 --- a/sorting/BeadSort.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// C++ program to implement gravity/bead sort -#include -#include -using namespace std; - -#define BEAD(i, j) beads[i * max + j] - -// function to perform the above algorithm -void beadSort(int *a, int len) -{ - // Find the maximum element - int max = a[0]; - for (int i = 1; i < len; i++) - if (a[i] > max) - max = a[i]; - - // allocating memory - unsigned char beads[max*len]; - memset(beads, 0, sizeof(beads)); - - // mark the beads - for (int i = 0; i < len; i++) - for (int j = 0; j < a[i]; j++) - BEAD(i, j) = 1; - - for (int j = 0; j < max; j++) - { - // count how many beads are on each post - int sum = 0; - for (int i=0; i < len; i++) - { - sum += BEAD(i, j); - BEAD(i, j) = 0; - } - - // Move beads down - for (int i = len - sum; i < len; i++) - BEAD(i, j) = 1; - } - - // Put sorted values in array using beads - for (int i = 0; i < len; i++) - { - int j; - for (j = 0; j < max && BEAD(i, j); j++); - - a[i] = j; - } -} - -// driver function to test the algorithm -int main() -{ - int a[] = {5, 3, 1, 7, 4, 1, 1, 20}; - int len = sizeof(a)/sizeof(a[0]); - - beadSort(a, len); - - for (int i = 0; i < len; i++) - printf("%d ", a[i]); - - return 0; -} diff --git a/sorting/BitonicSort.cpp b/sorting/BitonicSort.cpp deleted file mode 100644 index 6ad2489d2..000000000 --- a/sorting/BitonicSort.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Source : https://www.geeksforgeeks.org/bitonic-sort/ - -/* C++ Program for Bitonic Sort. Note that this program - works only when size of input is a power of 2. */ - -#include -#include -using namespace std; - -/*The parameter dir indicates the sorting direction, ASCENDING - or DESCENDING; if (a[i] > a[j]) agrees with the direction, - then a[i] and a[j] are interchanged.*/ -void compAndSwap(int a[], int i, int j, int dir) -{ - if (dir == (a[i] > a[j])) - swap(a[i], a[j]); -} - -/*It recursively sorts a bitonic sequence in ascending order, - if dir = 1, and in descending order otherwise (means dir=0). - The sequence to be sorted starts at index position low, - the parameter cnt is the number of elements to be sorted.*/ -void bitonicMerge(int a[], int low, int cnt, int dir) -{ - if (cnt > 1) - { - int k = cnt / 2; - for (int i = low; i < low + k; i++) - compAndSwap(a, i, i + k, dir); - bitonicMerge(a, low, k, dir); - bitonicMerge(a, low + k, k, dir); - } -} - -/* This function first produces a bitonic sequence by recursively - sorting its two halves in opposite sorting orders, and then - calls bitonicMerge to make them in the same order */ -void bitonicSort(int a[], int low, int cnt, int dir) -{ - if (cnt > 1) - { - int k = cnt / 2; - - // sort in ascending order since dir here is 1 - bitonicSort(a, low, k, 1); - - // sort in descending order since dir here is 0 - bitonicSort(a, low + k, k, 0); - - // Will merge wole sequence in ascending order - // since dir=1. - bitonicMerge(a, low, cnt, dir); - } -} - -/* Caller of bitonicSort for sorting the entire array of - length N in ASCENDING order */ -void sort(int a[], int N, int up) -{ - bitonicSort(a, 0, N, up); -} - -// Driver code -int main() -{ - int a[] = {3, 7, 4, 8, 6, 2, 1, 5}; - int N = sizeof(a) / sizeof(a[0]); - - int up = 1; // means sort in ascending order - sort(a, N, up); - - printf("Sorted array: \n"); - for (int i = 0; i < N; i++) - printf("%d ", a[i]); - return 0; -} diff --git a/sorting/Bubble Sort.cpp b/sorting/Bubble Sort.cpp deleted file mode 100644 index b160ac479..000000000 --- a/sorting/Bubble Sort.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//Bubble Sort - -#include -#include -using namespace std; - -int main() -{ - int n; - short swap_check = 1; - cout << "Enter the amount of numbers to sort: "; - cin >> n; - vector numbers; - cout << "Enter " << n << " numbers: "; - int num; - - //Input - for (int i = 0; i < n; i++) - { - cin >> num; - numbers.push_back(num); - } - - //Bubble Sorting - for (int i = 0; (i < n) && (swap_check == 1); i++) - { - swap_check = 0; - for (int j = 0; j < n - 1 - i; j++) - { - if (numbers[j] > numbers[j + 1]) - { - swap_check = 1; - swap(numbers[j], numbers[j + 1]);// by changing swap location. I mean, j. If the number is greater than j + 1, then it means the location. - } - } - } - - //Output - cout << "\nSorted Array : "; - for (int i = 0; i < numbers.size(); i++) - { - if (i != numbers.size() - 1) - { - cout << numbers[i] << ", "; - } - else - { - cout << numbers[i] << endl; - } - } - return 0; -} - -/*The working principle of the Bubble sort algorithm: - -Bubble sort algorithm is the bubble sorting algorithm. The most important reason for calling the bubble is that the largest number is thrown at the end of this algorithm. -This is all about the logic. -In each iteration, the largest number is expired and when iterations are completed, the sorting takes place. - -What is Swap? - -Swap in the software means that two variables are displaced. -An additional variable is required for this operation. x = 5, y = 10. -We want x = 10, y = 5. Here we create the most variable to do it. - -int z; -z = x; -x = y; -y = z; - -The above process is a typical displacement process. -When x assigns the value to x, the old value of x is lost. -That's why we created a variable z to create the first value of the value of x, and finally, we have assigned to y. - -Bubble Sort Algorithm Analysis (Best Case - Worst Case - Average Case) - -Bubble Sort Worst Case Performance is O (n²). Why is that? Because if you remember Big O Notation, we were calculating the complexity of the algorithms in the nested loops. -The n * (n - 1) product gives us O (n²) performance. In the worst case all the steps of the cycle will occur. -Bubble Sort (Avarage Case) Performance. Bubble Sort is not an optimal algorithm. -in average, O (n²) performance is taken. -Bubble Sort Best Case Performance. O (n). -However, you can't get the best status in the code we shared above. This happens on the optimized bubble sort algorithm. It's right down there. -* / diff --git a/sorting/CMakeLists.txt b/sorting/CMakeLists.txt new file mode 100644 index 000000000..00877bb61 --- /dev/null +++ b/sorting/CMakeLists.txt @@ -0,0 +1,20 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES + LINKER_LANGUAGE CXX + CXX_STANDARD 14) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/sorting") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/sorting/CocktailSelectionSort.cpp b/sorting/CocktailSelectionSort.cpp deleted file mode 100644 index cac6a3618..000000000 --- a/sorting/CocktailSelectionSort.cpp +++ /dev/null @@ -1,109 +0,0 @@ -//Returns Sorted elements after performing Cocktail Selection Sort -//It is a Sorting algorithm which chooses the minimum and maximum element in an array simultaneously, -//and swaps it with the lowest and highest available position iteratively or recursively - -#include -using namespace std; - -//Iterative Version - -void CocktailSelectionSort(vector &vec, int low, int high) -{ - while (low <= high) - { - int minimum = vec[low]; - int minimumindex = low; - int maximum = vec[high]; - int maximumindex = high; - - for (int i = low; i <= high; i++) - { - if (vec[i] >= maximum) - { - maximum = vec[i]; - maximumindex = i; - } - if (vec[i] <= minimum) - { - minimum = vec[i]; - minimumindex = i; - } - } - if (low != maximumindex || high != minimumindex) - { - swap(vec[low], vec[minimumindex]); - swap(vec[high], vec[maximumindex]); - } - else - { - swap(vec[low], vec[high]); - } - - low++; - high--; - } -} - -//Recursive Version - -void CocktailSelectionSort(vector &vec, int low, int high) -{ - - if (low >= high) - return; - - int minimum = vec[low]; - int minimumindex = low; - int maximum = vec[high]; - int maximumindex = high; - - for (int i = low; i <= high; i++) - { - if (vec[i] >= maximum) - { - maximum = vec[i]; - maximumindex = i; - } - if (vec[i] <= minimum) - { - minimum = vec[i]; - minimumindex = i; - } - } - if (low != maximumindex || high != minimumindex) - { - swap(vec[low], vec[minimumindex]); - swap(vec[high], vec[maximumindex]); - } - else - { - swap(vec[low], vec[high]); - } - - CocktailSelectionSort(vec, low + 1, high - 1); -} - -//main function, select any one of iterative or recursive version - -int main() -{ - - int n; - cout << "Enter number of elements\n"; - cin >> n; - std::vector v(n); - cout << "Enter all the elements\n"; - for (int i = 0; i < n; ++i) - { - cin >> v[i]; - } - - CocktailSelectionSort(v, 0, n - 1); - cout << "Sorted elements are\n"; - for (int i = 0; i < n; ++i) - { - cout << v[i] << " "; - } - - return 0; -} diff --git a/sorting/Counting_Sort.cpp b/sorting/Counting_Sort.cpp deleted file mode 100644 index bda37bbd8..000000000 --- a/sorting/Counting_Sort.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -using namespace std; - -int Max(int Arr[], int N) -{ - int max = Arr[0]; - for (int i = 1; i < N; i++) - if (Arr[i] > max) - max = Arr[i]; - return max; -} - -int Min(int Arr[], int N) -{ - int min = Arr[0]; - for (int i = 1; i < N; i++) - if (Arr[i] < min) - min = Arr[i]; - return min; -} - -void Print(int Arr[], int N) -{ - for (int i = 0; i < N; i++) - cout << Arr[i] << ", "; -} - -int *Counting_Sort(int Arr[], int N) -{ - - int max = Max(Arr, N); - int min = Min(Arr, N); - int *Sorted_Arr = new int[N]; - - int *Count = new int[max - min + 1]; - - for (int i = 0; i < N; i++) - Count[Arr[i] - min]++; - - for (int i = 1; i < (max - min + 1); i++) - Count[i] += Count[i - 1]; - - for (int i = N - 1; i >= 0; i--) - { - Sorted_Arr[Count[Arr[i] - min] - 1] = Arr[i]; - Count[Arr[i] - min]--; - } - - return Sorted_Arr; -} - -int main() -{ - - int Arr[] = {47, 65, 20, 66, 25, 53, 64, 69, 72, 22, 74, 25, 53, 15, 42, 36, 4, 69, 86, 19}, N = 20; - int *Sorted_Arr; - - cout << "\n\tOrignal Array = "; - Print(Arr, N); - Sorted_Arr = Counting_Sort(Arr, N); - cout << "\n\t Sorted Array = "; - Print(Sorted_Arr, N); - cout << endl; - - return 0; -} diff --git a/sorting/Insertion Sort.cpp b/sorting/Insertion Sort.cpp deleted file mode 100644 index 2563acaf8..000000000 --- a/sorting/Insertion Sort.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//Insertion Sort - -#include -using namespace std; - -int main() -{ - int n; - cout << "\nEnter the length of your array : "; - cin >> n; - int Array[n]; - cout << "\nEnter any " << n << " Numbers for Unsorted Array : "; - - //Input - for (int i = 0; i < n; i++) - { - cin >> Array[i]; - } - - //Sorting - for (int i = 1; i < n; i++) - { - int temp = Array[i]; - int j = i - 1; - while (j >= 0 && temp < Array[j]) - { - Array[j + 1] = Array[j]; - j--; - } - Array[j + 1] = temp; - } - - //Output - cout << "\nSorted Array : "; - for (int i = 0; i < n; i++) - { - cout << Array[i] << "\t"; - } - return 0; -} diff --git a/sorting/Merge Sort.cpp b/sorting/Merge Sort.cpp deleted file mode 100644 index b8edc8851..000000000 --- a/sorting/Merge Sort.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include -using namespace std; - -void merge(int arr[], int l, int m, int r) -{ - int i, j, k; - int n1 = m - l + 1; - int n2 = r - m; - - int L[n1], R[n2]; - - for (i = 0; i < n1; i++) - L[i] = arr[l + i]; - for (j = 0; j < n2; j++) - R[j] = arr[m + 1 + j]; - - i = 0; - j = 0; - k = l; - while (i < n1 && j < n2) - { - if (L[i] <= R[j]) - { - arr[k] = L[i]; - i++; - } - else - { - arr[k] = R[j]; - j++; - } - k++; - } - - while (i < n1) - { - arr[k] = L[i]; - i++; - k++; - } - - while (j < n2) - { - arr[k] = R[j]; - j++; - k++; - } -} - -void mergeSort(int arr[], int l, int r) -{ - if (l < r) - { - - int m = l + (r - l) / 2; - - mergeSort(arr, l, m); - mergeSort(arr, m + 1, r); - - merge(arr, l, m, r); - } -} - -void show(int A[], int size) -{ - int i; - for (i = 0; i < size; i++) - cout << A[i] << "\n"; -} - -int main() -{ - int size; - cout << "\nEnter the number of elements : "; - - cin >> size; - - int arr[size]; - - cout << "\nEnter the unsorted elements : "; - - for (int i = 0; i < size; ++i) - { - cout << "\n"; - cin >> arr[i]; - } - - mergeSort(arr, 0, size); - - cout << "Sorted array\n"; - show(arr, size); - return 0; -} diff --git a/sorting/NumericStringSort.cpp b/sorting/NumericStringSort.cpp deleted file mode 100644 index 02f6964ba..000000000 --- a/sorting/NumericStringSort.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//Using general algorithms to sort a collection of strings results in alphanumeric sort. -//If it is a numeric string, it leads to unnatural sorting - -//eg, an array of strings 1,10,100,2,20,200,3,30,300 -//would be sorted in that same order by using conventional sorting, -//even though we know the correct sorting order is 1,2,3,10,20,30,100,200,300 - -//This Programme uses a comparator to sort the array in Numerical order instead of Alphanumeric order - -#include -#include -#include -using namespace std; - -bool NumericSort(string a, string b) -{ - while (a[0] == '0') - { - a.erase(a.begin()); - } - while (b[0] == '0') - { - b.erase(b.begin()); - } - int n = a.length(); - int m = b.length(); - if (n == m) - return a < b; - return n < m; -} - -int main() -{ - - int n; - cout << "Enter number of elements to be sorted Numerically\n"; - cin >> n; - - vector v(n); - cout << "Enter the string of Numbers\n"; - for (int i = 0; i < n; i++) - { - cin >> v[i]; - } - - sort(v.begin(), v.end()); - cout << "Elements sorted normally \n"; - for (int i = 0; i < n; i++) - { - cout << v[i] << " "; - } - cout << "\n"; - - sort(v.begin(), v.end(), NumericSort); - cout << "Elements sorted Numerically \n"; - for (int i = 0; i < n; i++) - { - cout << v[i] << " "; - } - - return 0; -} diff --git a/sorting/OddEven Sort.cpp b/sorting/OddEven Sort.cpp deleted file mode 100644 index 62842c174..000000000 --- a/sorting/OddEven Sort.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* C++ implementation Odd Even Sort */ -#include -#include - -using namespace std; - -void oddEven(vector &arr, int size) -{ - bool sorted = false; - while (!sorted) - { - sorted = true; - for (int i = 1; i < size - 1; i += 2) //Odd - { - if (arr[i] > arr[i + 1]) - { - swap(arr[i], arr[i + 1]); - sorted = false; - } - } - - for (int i = 0; i < size - 1; i += 2) //Even - { - if (arr[i] > arr[i + 1]) - { - swap(arr[i], arr[i + 1]); - sorted = false; - } - } - } -} - -void show(vector A, int size) -{ - int i; - for (i = 0; i < size; i++) - cout << A[i] << "\n"; -} - -int main() -{ - int size, temp; - cout << "\nEnter the number of elements : "; - cin >> size; - - vector arr; - - cout << "\nEnter the unsorted elements : \n"; - - for (int i = 0; i < size; ++i) - { - cin >> temp; - arr.push_back(temp); - } - - oddEven(arr, size); - - cout << "Sorted array\n"; - show(arr, size); - return 0; -} diff --git a/sorting/Quick Sort.cpp b/sorting/Quick Sort.cpp deleted file mode 100644 index 0b807898f..000000000 --- a/sorting/Quick Sort.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* C implementation QuickSort */ -#include -using namespace std; - -int partition(int arr[], int low, int high) -{ - int pivot = arr[high]; // pivot - int i = (low - 1); // Index of smaller element - - for (int j = low; j < high; j++) - { - // If current element is smaller than or - // equal to pivot - if (arr[j] <= pivot) - { - i++; // increment index of smaller element - int temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - } - } - int temp = arr[i + 1]; - arr[i + 1] = arr[high]; - arr[high] = temp; - return (i + 1); -} - -void quickSort(int arr[], int low, int high) -{ - if (low < high) - { - - int p = partition(arr, low, high); - - quickSort(arr, low, p - 1); - quickSort(arr, p + 1, high); - } -} - -void show(int arr[], int size) -{ - for (int i = 0; i < size; i++) - cout << arr[i] << "\n"; -} - -// Driver program to test above functions -int main() -{ - int size; - cout << "\nEnter the number of elements : "; - - cin >> size; - - int arr[size]; - - cout << "\nEnter the unsorted elements : "; - - for (int i = 0; i < size; ++i) - { - cout << "\n"; - cin >> arr[i]; - } - quickSort(arr, 0, size); - cout << "Sorted array\n"; - show(arr, size); - return 0; -} diff --git a/sorting/Radix Sort.cpp b/sorting/Radix Sort.cpp deleted file mode 100644 index 09c91bb22..000000000 --- a/sorting/Radix Sort.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -using namespace std; -void radixsort(int a[], int n) -{ - int count[10]; - int output[n]; - memset(output, 0, sizeof(output)); - memset(count, 0, sizeof(count)); - int max = 0; - for (int i = 0; i < n; ++i) - { - if (a[i] > max) - { - max = a[i]; - } - } - int maxdigits = 0; - while (max) - { - maxdigits++; - max /= 10; - } - for (int j = 0; j < maxdigits; j++) - { - for (int i = 0; i < n; i++) - { - int t = pow(10, j); - count[(a[i] % (10 * t)) / t]++; - } - int k = 0; - for (int p = 0; p < 10; p++) - { - for (int i = 0; i < n; i++) - { - int t = pow(10, j); - if ((a[i] % (10 * t)) / t == p) - { - output[k] = a[i]; - k++; - } - } - } - memset(count, 0, sizeof(count)); - for (int i = 0; i < n; ++i) - { - a[i] = output[i]; - } - } -} -void print(int a[], int n) -{ - for (int i = 0; i < n; ++i) - { - cout << a[i] << " "; - } - cout << endl; -} -int main(int argc, char const *argv[]) -{ - int a[] = {170, 45, 75, 90, 802, 24, 2, 66}; - int n = sizeof(a) / sizeof(a[0]); - radixsort(a, n); - print(a, n); - return 0; -} \ No newline at end of file diff --git a/sorting/Selection Sort.cpp b/sorting/Selection Sort.cpp deleted file mode 100644 index 5b8724141..000000000 --- a/sorting/Selection Sort.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//Selection Sort - -#include -using namespace std; - -int main() -{ - int Array[6]; - cout << "\nEnter any 6 Numbers for Unsorted Array : "; - - //Input - for (int i = 0; i < 6; i++) - { - cin >> Array[i]; - } - - //Selection Sorting - for (int i = 0; i < 6; i++) - { - int min = i; - for (int j = i + 1; j < 6; j++) - { - if (Array[j] < Array[min]) - { - min = j; //Finding the smallest number in Array - } - } - int temp = Array[i]; - Array[i] = Array[min]; - Array[min] = temp; - } - - //Output - cout << "\nSorted Array : "; - for (int i = 0; i < 6; i++) - { - cout << Array[i] << "\t"; - } -} diff --git a/sorting/Shell Sort.cpp b/sorting/Shell Sort.cpp deleted file mode 100644 index b08c7ffd8..000000000 --- a/sorting/Shell Sort.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -using namespace std; - -int main() -{ - int size = 10; - int array[size]; - // Input - cout << "\nHow many numbers do want to enter in unsorted array : "; - cin >> size; - cout << "\nEnter the numbers for unsorted array : "; - for (int i = 0; i < size; i++) - { - cin >> array[i]; - } - - // Sorting - for (int i = size / 2; i > 0; i = i / 2) - { - for (int j = i; j < size; j++) - { - for (int k = j - i; k >= 0; k = k - i) - { - if (array[k] < array[k + i]) - { - break; - } - else - { - int temp = array[k + i]; - array[k + i] = array[k]; - array[k] = temp; - } - } - } - } - - // Output - cout << "\nSorted array : "; - for (int i = 0; i < size; ++i) - { - cout << array[i] << "\t"; - } - return 0; -} diff --git a/sorting/Slow Sort.cpp b/sorting/Slow Sort.cpp deleted file mode 100644 index f8f7e74b8..000000000 --- a/sorting/Slow Sort.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//Returns the sorted vector after performing SlowSort -//It is a sorting algorithm that is of humorous nature and not useful. -//It's based on the principle of multiply and surrender, a tongue-in-cheek joke of divide and conquer. -//It was published in 1986 by Andrei Broder and Jorge Stolfi in their paper Pessimal Algorithms and Simplexity Analysis. -//This algorithm multiplies a single problem into multiple subproblems -//It is interesting because it is provably the least efficient sorting algorithm that can be built asymptotically, -//and with the restriction that such an algorithm, while being slow, must still all the time be working towards a result. - -#include -using namespace std; - -void SlowSort(int a[], int i, int j) -{ - if (i >= j) - return; - int m = i + (j - i) / 2; //midpoint, implemented this way to avoid overflow - int temp; - SlowSort(a, i, m); - SlowSort(a, m + 1, j); - if (a[j] < a[m]) - { - temp = a[j]; //swapping a[j] & a[m] - a[j] = a[m]; - a[m] = temp; - } - SlowSort(a, i, j - 1); -} - -//Sample Main function - -int main() -{ - int size; - cout << "\nEnter the number of elements : "; - - cin >> size; - - int arr[size]; - - cout << "\nEnter the unsorted elements : "; - - for (int i = 0; i < size; ++i) - { - cout << "\n"; - cin >> arr[i]; - } - - SlowSort(arr, 0, size); - - cout << "Sorted array\n"; - - for (int i = 0; i < size; ++i) - { - cout << arr[i] << " "; - } - return 0; -} diff --git a/sorting/bead_sort.cpp b/sorting/bead_sort.cpp new file mode 100644 index 000000000..f3276bfcd --- /dev/null +++ b/sorting/bead_sort.cpp @@ -0,0 +1,56 @@ +// C++ program to implement gravity/bead sort +#include +#include + +#define BEAD(i, j) beads[i * max + j] + +// function to perform the above algorithm +void beadSort(int *a, int len) { + // Find the maximum element + int max = a[0]; + for (int i = 1; i < len; i++) + if (a[i] > max) + max = a[i]; + + // allocating memory + unsigned char *beads = new unsigned char[max * len]; + memset(beads, 0, max * len); + + // mark the beads + for (int i = 0; i < len; i++) + for (int j = 0; j < a[i]; j++) BEAD(i, j) = 1; + + for (int j = 0; j < max; j++) { + // count how many beads are on each post + int sum = 0; + for (int i = 0; i < len; i++) { + sum += BEAD(i, j); + BEAD(i, j) = 0; + } + + // Move beads down + for (int i = len - sum; i < len; i++) BEAD(i, j) = 1; + } + + // Put sorted values in array using beads + for (int i = 0; i < len; i++) { + int j; + for (j = 0; j < max && BEAD(i, j); j++) { + } + + a[i] = j; + } + delete[] beads; +} + +// driver function to test the algorithm +int main() { + int a[] = {5, 3, 1, 7, 4, 1, 1, 20}; + int len = sizeof(a) / sizeof(a[0]); + + beadSort(a, len); + + for (int i = 0; i < len; i++) printf("%d ", a[i]); + + return 0; +} diff --git a/sorting/bitonic_sort.cpp b/sorting/bitonic_sort.cpp new file mode 100644 index 000000000..0fbb995ac --- /dev/null +++ b/sorting/bitonic_sort.cpp @@ -0,0 +1,64 @@ +// Source : https://www.geeksforgeeks.org/bitonic-sort/ + +/* C++ Program for Bitonic Sort. Note that this program + works only when size of input is a power of 2. */ + +#include +#include + +/*The parameter dir indicates the sorting direction, ASCENDING + or DESCENDING; if (a[i] > a[j]) agrees with the direction, + then a[i] and a[j] are interchanged.*/ +void compAndSwap(int a[], int i, int j, int dir) { + if (dir == (a[i] > a[j])) + std::swap(a[i], a[j]); +} + +/*It recursively sorts a bitonic sequence in ascending order, + if dir = 1, and in descending order otherwise (means dir=0). + The sequence to be sorted starts at index position low, + the parameter cnt is the number of elements to be sorted.*/ +void bitonicMerge(int a[], int low, int cnt, int dir) { + if (cnt > 1) { + int k = cnt / 2; + for (int i = low; i < low + k; i++) compAndSwap(a, i, i + k, dir); + bitonicMerge(a, low, k, dir); + bitonicMerge(a, low + k, k, dir); + } +} + +/* This function first produces a bitonic sequence by recursively + sorting its two halves in opposite sorting orders, and then + calls bitonicMerge to make them in the same order */ +void bitonicSort(int a[], int low, int cnt, int dir) { + if (cnt > 1) { + int k = cnt / 2; + + // sort in ascending order since dir here is 1 + bitonicSort(a, low, k, 1); + + // sort in descending order since dir here is 0 + bitonicSort(a, low + k, k, 0); + + // Will merge wole sequence in ascending order + // since dir=1. + bitonicMerge(a, low, cnt, dir); + } +} + +/* Caller of bitonicSort for sorting the entire array of + length N in ASCENDING order */ +void sort(int a[], int N, int up) { bitonicSort(a, 0, N, up); } + +// Driver code +int main() { + int a[] = {3, 7, 4, 8, 6, 2, 1, 5}; + int N = sizeof(a) / sizeof(a[0]); + + int up = 1; // means sort in ascending order + sort(a, N, up); + + std::cout << "Sorted array: \n"; + for (int i = 0; i < N; i++) std::cout << a[i] << " "; + return 0; +} diff --git a/sorting/bubble_sort.cpp b/sorting/bubble_sort.cpp new file mode 100644 index 000000000..c43e425fc --- /dev/null +++ b/sorting/bubble_sort.cpp @@ -0,0 +1,83 @@ +/** + * @file + * @brief Bubble sort algorithm + * + * The working principle of the Bubble sort algorithm: + +Bubble sort algorithm is the bubble sorting algorithm. The most important reason +for calling the bubble is that the largest number is thrown at the end of this +algorithm. This is all about the logic. In each iteration, the largest number is +expired and when iterations are completed, the sorting takes place. + +What is Swap? + +Swap in the software means that two variables are displaced. +An additional variable is required for this operation. x = 5, y = 10. +We want x = 10, y = 5. Here we create the most variable to do it. + +int z; +z = x; +x = y; +y = z; + +The above process is a typical displacement process. +When x assigns the value to x, the old value of x is lost. +That's why we created a variable z to create the first value of the value of x, +and finally, we have assigned to y. + +Bubble Sort Algorithm Analysis (Best Case - Worst Case - Average Case) + +Bubble Sort Worst Case Performance is O (n²). Why is that? Because if you +remember Big O Notation, we were calculating the complexity of the algorithms in +the nested loops. The n * (n - 1) product gives us O (n²) performance. In the +worst case all the steps of the cycle will occur. Bubble Sort (Avarage Case) +Performance. Bubble Sort is not an optimal algorithm. in average, O (n²) +performance is taken. Bubble Sort Best Case Performance. O (n). However, you +can't get the best status in the code we shared above. This happens on the +optimized bubble sort algorithm. It's right down there. +*/ + +#include +#include + +int main() { + int n; + bool swap_check = true; + std::cout << "Enter the amount of numbers to sort: "; + std::cin >> n; + std::vector numbers; + std::cout << "Enter " << n << " numbers: "; + int num; + + // Input + for (int i = 0; i < n; i++) { + std::cin >> num; + numbers.push_back(num); + } + + // Bubble Sorting + for (int i = 0; (i < n) && (swap_check); i++) { + swap_check = false; + for (int j = 0; j < n - 1 - i; j++) { + if (numbers[j] > numbers[j + 1]) { + swap_check = true; + std::swap(numbers[j], + numbers[j + 1]); // by changing swap location. + // I mean, j. If the number is + // greater than j + 1, then it + // means the location. + } + } + } + + // Output + std::cout << "\nSorted Array : "; + for (int i = 0; i < numbers.size(); i++) { + if (i != numbers.size() - 1) { + std::cout << numbers[i] << ", "; + } else { + std::cout << numbers[i] << std::endl; + } + } + return 0; +} diff --git a/sorting/bucketSort.cpp b/sorting/bucketSort.cpp deleted file mode 100644 index 0ffbf8e4c..000000000 --- a/sorting/bucketSort.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// C++ program to sort an array using bucket sort -#include -#include -#include -using namespace std; - -// Function to sort arr[] of size n using bucket sort -void bucketSort(float arr[], int n) -{ - // 1) Create n empty buckets - vector b[n]; - - // 2) Put array elements in different buckets - for (int i = 0; i < n; i++) - { - int bi = n * arr[i]; // Index in bucket - b[bi].push_back(arr[i]); - } - - // 3) Sort individual buckets - for (int i = 0; i < n; i++) - sort(b[i].begin(), b[i].end()); - - // 4) Concatenate all buckets into arr[] - int index = 0; - for (int i = 0; i < n; i++) - for (int j = 0; j < b[i].size(); j++) - arr[index++] = b[i][j]; -} - -/* Driver program to test above funtion */ -int main() -{ - float arr[] = {0.897, 0.565, 0.656, 0.1234, 0.665, 0.3434}; - int n = sizeof(arr) / sizeof(arr[0]); - bucketSort(arr, n); - - cout << "Sorted array is \n"; - for (int i = 0; i < n; i++) - cout << arr[i] << " "; - return 0; -} diff --git a/sorting/bucket_sort.cpp b/sorting/bucket_sort.cpp new file mode 100644 index 000000000..c43865281 --- /dev/null +++ b/sorting/bucket_sort.cpp @@ -0,0 +1,36 @@ +// C++ program to sort an array using bucket sort +#include +#include +#include + +// Function to sort arr[] of size n using bucket sort +void bucketSort(float arr[], int n) { + // 1) Create n empty buckets + std::vector *b = new std::vector[n]; + + // 2) Put array elements in different buckets + for (int i = 0; i < n; i++) { + int bi = n * arr[i]; // Index in bucket + b[bi].push_back(arr[i]); + } + + // 3) Sort individual buckets + for (int i = 0; i < n; i++) std::sort(b[i].begin(), b[i].end()); + + // 4) Concatenate all buckets into arr[] + int index = 0; + for (int i = 0; i < n; i++) + for (int j = 0; j < b[i].size(); j++) arr[index++] = b[i][j]; + delete[] b; +} + +/* Driver program to test above funtion */ +int main() { + float arr[] = {0.897, 0.565, 0.656, 0.1234, 0.665, 0.3434}; + int n = sizeof(arr) / sizeof(arr[0]); + bucketSort(arr, n); + + std::cout << "Sorted array is \n"; + for (int i = 0; i < n; i++) std::cout << arr[i] << " "; + return 0; +} diff --git a/sorting/cocktail_selection_sort.cpp b/sorting/cocktail_selection_sort.cpp new file mode 100644 index 000000000..157acafce --- /dev/null +++ b/sorting/cocktail_selection_sort.cpp @@ -0,0 +1,102 @@ +// Returns Sorted elements after performing Cocktail Selection Sort +// It is a Sorting algorithm which chooses the minimum and maximum element in an +// array simultaneously, and swaps it with the lowest and highest available +// position iteratively or recursively + +#include +#include +#include + +// Iterative Version + +void CocktailSelectionSort(std::vector *vec, int low, int high) { + while (low <= high) { + int minimum = (*vec)[low]; + int minimumindex = low; + int maximum = (*vec)[high]; + int maximumindex = high; + + for (int i = low; i <= high; i++) { + if ((*vec)[i] >= maximum) { + maximum = (*vec)[i]; + maximumindex = i; + } + if ((*vec)[i] <= minimum) { + minimum = (*vec)[i]; + minimumindex = i; + } + } + if (low != maximumindex || high != minimumindex) { + std::swap((*vec)[low], (*vec)[minimumindex]); + std::swap((*vec)[high], (*vec)[maximumindex]); + } else { + std::swap((*vec)[low], (*vec)[high]); + } + + low++; + high--; + } +} + +// Recursive Version + +void CocktailSelectionSort_v2(std::vector *vec, int low, int high) { + if (low >= high) + return; + + int minimum = (*vec)[low]; + int minimumindex = low; + int maximum = (*vec)[high]; + int maximumindex = high; + + for (int i = low; i <= high; i++) { + if ((*vec)[i] >= maximum) { + maximum = (*vec)[i]; + maximumindex = i; + } + if ((*vec)[i] <= minimum) { + minimum = (*vec)[i]; + minimumindex = i; + } + } + if (low != maximumindex || high != minimumindex) { + std::swap((*vec)[low], (*vec)[minimumindex]); + std::swap((*vec)[high], (*vec)[maximumindex]); + } else { + std::swap((*vec)[low], (*vec)[high]); + } + + CocktailSelectionSort(vec, low + 1, high - 1); +} + +// main function, select any one of iterative or recursive version + +int main() { + int n; + std::cout << "Enter number of elements\n"; + std::cin >> n; + std::vector v(n); + std::cout << "Enter all the elements\n"; + for (int i = 0; i < n; ++i) { + std::cin >> v[i]; + } + + int method; + std::cout << "Enter method: \n\t0: iterative\n\t1: recursive:\t"; + std::cin >> method; + + if (method == 0) { + CocktailSelectionSort(&v, 0, n - 1); + } else if (method == 1) { + CocktailSelectionSort_v2(&v, 0, n - 1); + } else { + std::cerr << "Unknown method" << std::endl; + return -1; + } + std::cout << "Sorted elements are\n"; + for (int i = 0; i < n; ++i) { + std::cout << v[i] << " "; + } + + return 0; +} diff --git a/sorting/comb_sort.cpp b/sorting/comb_sort.cpp new file mode 100644 index 000000000..1b0a4d706 --- /dev/null +++ b/sorting/comb_sort.cpp @@ -0,0 +1,49 @@ +// Kind of better version of Bubble sort. +// While Bubble sort is comparering adjacent value, Combsort is using gap larger +// than 1 Best case: O(n) Worst case: O(n ^ 2) + +#include +#include + +int a[100005]; +int n; + +int FindNextGap(int x) { + x = (x * 10) / 13; + + return std::max(1, x); +} + +void CombSort(int a[], int l, int r) { + // Init gap + int gap = n; + + // Initialize swapped as true to make sure that loop runs + bool swapped = true; + + // Keep running until gap = 1 or none elements were swapped + while (gap != 1 || swapped) { + // Find next gap + gap = FindNextGap(gap); + + swapped = false; + + // Compare all elements with current gap + for (int i = l; i <= r - gap; ++i) { + if (a[i] > a[i + gap]) { + std::swap(a[i], a[i + gap]); + swapped = true; + } + } + } +} + +int main() { + std::cin >> n; + for (int i = 1; i <= n; ++i) std::cin >> a[i]; + + CombSort(a, 1, n); + + for (int i = 1; i <= n; ++i) std::cout << a[i] << ' '; + return 0; +} diff --git a/sorting/combsort.cpp b/sorting/combsort.cpp deleted file mode 100644 index 2209c96fc..000000000 --- a/sorting/combsort.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//Kind of better version of Bubble sort. -//While Bubble sort is comparering adjacent value, Combsort is using gap larger than 1 -//Best case: O(n) -//Worst case: O(n ^ 2) - -#include - -using namespace std; - -int a[100005]; -int n; - -int FindNextGap(int x) -{ - x = (x * 10) / 13; - - return max(1, x); -} - -void CombSort(int a[], int l, int r) -{ - //Init gap - int gap = n; - - //Initialize swapped as true to make sure that loop runs - bool swapped = true; - - //Keep running until gap = 1 or none elements were swapped - while (gap != 1 || swapped) - { - //Find next gap - gap = FindNextGap(gap); - - swapped = false; - - // Compare all elements with current gap - for (int i = l; i <= r - gap; ++i) - { - if (a[i] > a[i + gap]) - { - swap(a[i], a[i + gap]); - swapped = true; - } - } - } -} - -int main() -{ - cin >> n; - for (int i = 1; i <= n; ++i) - cin >> a[i]; - - CombSort(a, 1, n); - - for (int i = 1; i <= n; ++i) - cout << a[i] << ' '; - return 0; -} diff --git a/sorting/counting_sort.cpp b/sorting/counting_sort.cpp new file mode 100644 index 000000000..1fbfc0fa3 --- /dev/null +++ b/sorting/counting_sort.cpp @@ -0,0 +1,57 @@ +#include +using namespace std; + +int Max(int Arr[], int N) { + int max = Arr[0]; + for (int i = 1; i < N; i++) + if (Arr[i] > max) + max = Arr[i]; + return max; +} + +int Min(int Arr[], int N) { + int min = Arr[0]; + for (int i = 1; i < N; i++) + if (Arr[i] < min) + min = Arr[i]; + return min; +} + +void Print(int Arr[], int N) { + for (int i = 0; i < N; i++) cout << Arr[i] << ", "; +} + +int *Counting_Sort(int Arr[], int N) { + int max = Max(Arr, N); + int min = Min(Arr, N); + int *Sorted_Arr = new int[N]; + + int *Count = new int[max - min + 1]; + + for (int i = 0; i < N; i++) Count[Arr[i] - min]++; + + for (int i = 1; i < (max - min + 1); i++) Count[i] += Count[i - 1]; + + for (int i = N - 1; i >= 0; i--) { + Sorted_Arr[Count[Arr[i] - min] - 1] = Arr[i]; + Count[Arr[i] - min]--; + } + + return Sorted_Arr; +} + +int main() { + int Arr[] = {47, 65, 20, 66, 25, 53, 64, 69, 72, 22, + 74, 25, 53, 15, 42, 36, 4, 69, 86, 19}, + N = 20; + int *Sorted_Arr; + + cout << "\n\tOrignal Array = "; + Print(Arr, N); + Sorted_Arr = Counting_Sort(Arr, N); + cout << "\n\t Sorted Array = "; + Print(Sorted_Arr, N); + cout << endl; + + return 0; +} diff --git a/sorting/CountingSortString.cpp b/sorting/counting_sort_string.cpp similarity index 50% rename from sorting/CountingSortString.cpp rename to sorting/counting_sort_string.cpp index 6179e5d11..977f3484d 100644 --- a/sorting/CountingSortString.cpp +++ b/sorting/counting_sort_string.cpp @@ -3,35 +3,27 @@ using namespace std; -void countSort(string arr) -{ - +void countSort(string arr) { string output; int count[256], i; - for (int i = 0; i < 256; i++) - count[i] = 0; + for (int i = 0; i < 256; i++) count[i] = 0; - for (i = 0; arr[i]; ++i) - ++count[arr[i]]; + for (i = 0; arr[i]; ++i) ++count[arr[i]]; - for (i = 1; i <= 256; ++i) - count[i] += count[i - 1]; + for (i = 1; i <= 256; ++i) count[i] += count[i - 1]; - for (i = 0; arr[i]; ++i) - { + for (i = 0; arr[i]; ++i) { output[count[arr[i]] - 1] = arr[i]; --count[arr[i]]; } - for (i = 0; arr[i]; ++i) - arr[i] = output[i]; + for (i = 0; arr[i]; ++i) arr[i] = output[i]; cout << "Sorted character array is " << arr; } -int main() -{ +int main() { string arr; cin >> arr; diff --git a/sorting/doxy.txt b/sorting/doxy.txt deleted file mode 100644 index 68079276e..000000000 --- a/sorting/doxy.txt +++ /dev/null @@ -1,374 +0,0 @@ -# Doxyfile 1.8.13 -#This configuration file has been generated from Doxygen template. -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "My Project" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = -CREATE_SUBDIRS = NO -ALLOW_UNICODE_NAMES = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -MARKDOWN_SUPPORT = YES -TOC_INCLUDE_HEADINGS = 0 -AUTOLINK_SUPPORT = YES -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -GROUP_NESTED_COMPOUNDS = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_PACKAGE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -HIDE_COMPOUND_REFERENCE= NO -SHOW_INCLUDE_FILES = YES -SHOW_GROUPED_MEMB_INC = NO -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_AS_ERROR = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.idl \ - *.ddl \ - *.odl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.cs \ - *.d \ - *.php \ - *.php4 \ - *.php5 \ - *.phtml \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.pyw \ - *.f90 \ - *.f95 \ - *.f03 \ - *.f08 \ - *.f \ - *.for \ - *.tcl \ - *.vhd \ - *.vhdl \ - *.ucf \ - *.qsf -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -USE_MDFILE_AS_MAINPAGE = -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -SOURCE_TOOLTIPS = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -CLANG_ASSISTED_PARSING = NO -CLANG_OPTIONS = -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = NO -HTML_DYNAMIC_SECTIONS = NO -HTML_INDEX_NUM_ENTRIES = 100 -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_FORMAT = HTML-CSS -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest -MATHJAX_EXTENSIONS = -MATHJAX_CODEFILE = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -EXTERNAL_SEARCH = NO -SEARCHENGINE_URL = -SEARCHDATA_FILE = searchdata.xml -EXTERNAL_SEARCH_ID = -EXTRA_SEARCH_MAPPINGS = -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -LATEX_EXTRA_STYLESHEET = -LATEX_EXTRA_FILES = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -LATEX_TIMESTAMP = NO -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -RTF_SOURCE_CODE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_SUBDIR = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- -GENERATE_DOCBOOK = NO -DOCBOOK_OUTPUT = docbook -DOCBOOK_PROGRAMLISTING = NO -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -EXTERNAL_PAGES = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -DIA_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -UML_LIMIT_NUM_FIELDS = 10 -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DIAFILE_DIRS = -PLANTUML_JAR_PATH = -PLANTUML_CFG_FILE = -PLANTUML_INCLUDE_PATH = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/sorting/insertion_sort.cpp b/sorting/insertion_sort.cpp new file mode 100644 index 000000000..fe920ca59 --- /dev/null +++ b/sorting/insertion_sort.cpp @@ -0,0 +1,36 @@ +// Insertion Sort + +#include + +int main() { + int n; + std::cout << "\nEnter the length of your array : "; + std::cin >> n; + int *Array = new int[n]; + std::cout << "\nEnter any " << n << " Numbers for Unsorted Array : "; + + // Input + for (int i = 0; i < n; i++) { + std::cin >> Array[i]; + } + + // Sorting + for (int i = 1; i < n; i++) { + int temp = Array[i]; + int j = i - 1; + while (j >= 0 && temp < Array[j]) { + Array[j + 1] = Array[j]; + j--; + } + Array[j + 1] = temp; + } + + // Output + std::cout << "\nSorted Array : "; + for (int i = 0; i < n; i++) { + std::cout << Array[i] << "\t"; + } + + delete[] Array; + return 0; +} diff --git a/sorting/library_sort.cpp b/sorting/library_sort.cpp index 6f1ab6245..c9cba88d8 100644 --- a/sorting/library_sort.cpp +++ b/sorting/library_sort.cpp @@ -8,8 +8,7 @@ void librarySort(int *index, int n) { bool target_lib, *numbered; - for (int i = 0; i < 2; i++) - library[i] = new int[n]; + for (int i = 0; i < 2; i++) library[i] = new int[n]; gaps = new int[n + 1]; numbered = new bool[n + 1]; @@ -79,8 +78,7 @@ int main() { librarySort(index_ex, n_ex); std::cout << "sorted array :" << std::endl; - for (int i = 0; i < n_ex; i++) - std::cout << index_ex[i] << " "; + for (int i = 0; i < n_ex; i++) std::cout << index_ex[i] << " "; std::cout << std::endl; /* --output-- diff --git a/sorting/makefile b/sorting/makefile deleted file mode 100644 index 21d3186c6..000000000 --- a/sorting/makefile +++ /dev/null @@ -1,11 +0,0 @@ -non_recursive_merge_sort: non_recursive_merge_sort.cpp - g++ -std=c++17 -o non_recursive_merge_sort non_recursive_merge_sort.cpp -.PHONY: test -.PHONY: doc -.PHONY: clean -test: non_recursive_merge_sort - ./non_recursive_merge_sort -doc: doxy.txt - doxygen doxy.txt -clean: - rm -fr non_recursive_merge_sort html diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp new file mode 100644 index 000000000..82ab869cd --- /dev/null +++ b/sorting/merge_sort.cpp @@ -0,0 +1,81 @@ +#include + +void merge(int arr[], int l, int m, int r) { + int i, j, k; + int n1 = m - l + 1; + int n2 = r - m; + + int *L = new int[n1], *R = new int[n2]; + + for (i = 0; i < n1; i++) L[i] = arr[l + i]; + for (j = 0; j < n2; j++) R[j] = arr[m + 1 + j]; + + i = 0; + j = 0; + k = l; + while (i < n1 && j < n2) { + if (L[i] <= R[j]) { + arr[k] = L[i]; + i++; + } else { + arr[k] = R[j]; + j++; + } + k++; + } + + while (i < n1) { + arr[k] = L[i]; + i++; + k++; + } + + while (j < n2) { + arr[k] = R[j]; + j++; + k++; + } + + delete[] L; + delete[] R; +} + +void mergeSort(int arr[], int l, int r) { + if (l < r) { + int m = l + (r - l) / 2; + + mergeSort(arr, l, m); + mergeSort(arr, m + 1, r); + + merge(arr, l, m, r); + } +} + +void show(int A[], int size) { + int i; + for (i = 0; i < size; i++) std::cout << A[i] << "\n"; +} + +int main() { + int size; + std::cout << "\nEnter the number of elements : "; + + std::cin >> size; + + int *arr = new int[size]; + + std::cout << "\nEnter the unsorted elements : "; + + for (int i = 0; i < size; ++i) { + std::cout << "\n"; + std::cin >> arr[i]; + } + + mergeSort(arr, 0, size); + + std::cout << "Sorted array\n"; + show(arr, size); + + delete[] arr; + return 0; +} diff --git a/sorting/non_recursive_merge_sort.cpp b/sorting/non_recursive_merge_sort.cpp index c6ca56376..9d4e95f2f 100644 --- a/sorting/non_recursive_merge_sort.cpp +++ b/sorting/non_recursive_merge_sort.cpp @@ -5,8 +5,10 @@ * A generic implementation of non-recursive merge sort. */ #include // for size_t +#include #include // for std::move & std::remove_reference_t -template + +template void merge(Iterator, Iterator, const Iterator, char[]); /// bottom-up merge sort which sorts elements in a non-decreasing order /** @@ -17,13 +19,13 @@ void merge(Iterator, Iterator, const Iterator, char[]); * @param first points to the first element * @param last points to 1-step past the last element * @param n the number of elements -*/ -template + */ +template void non_recursive_merge_sort(const Iterator first, const Iterator last, const size_t n) { // create a buffer large enough to store all elements // dynamically allocated to comply with cpplint - char * buffer = new char[n * sizeof(*first)]; + char* buffer = new char[n * sizeof(*first)]; // buffer size can be optimized to largest power of 2 less than n elements // divide the container into equally-sized segments whose length start at 1 // and keeps increasing by factors of 2 @@ -49,32 +51,28 @@ void non_recursive_merge_sort(const Iterator first, const Iterator last, * @param r points to the right part, end of left part * @param e points to end of right part * @param b points at the buffer -*/ -template + */ +template void merge(Iterator l, Iterator r, const Iterator e, char b[]) { // create 2 pointers to point at the buffer auto p(reinterpret_cast*>(b)), c(p); // move the left part of the segment - for (Iterator t(l); r != t; ++t) - *p++ = std::move(*t); + for (Iterator t(l); r != t; ++t) *p++ = std::move(*t); // while neither the buffer nor the right part has been exhausted // move the smallest element of the two back to the container - while (e != r && c != p) - *l++ = std::move(*r < *c ? *r++ : *c++); + while (e != r && c != p) *l++ = std::move(*r < *c ? *r++ : *c++); // notice only one of the two following loops will be executed // while the right part hasn't bee exhausted, move it back - while (e != r) - *l++ = std::move(*r++); + while (e != r) *l++ = std::move(*r++); // while the buffer hasn't bee exhausted, move it back - while (c != p) - *l++ = std::move(*c++); + while (c != p) *l++ = std::move(*c++); } /// bottom-up merge sort which sorts elements in a non-decreasing order /** * @param first points to the first element * @param n the number of elements -*/ -template + */ +template void non_recursive_merge_sort(const Iterator first, const size_t n) { non_recursive_merge_sort(first, first + n, n); } @@ -82,25 +80,17 @@ void non_recursive_merge_sort(const Iterator first, const size_t n) { /** * @param first points to the first element * @param last points to 1-step past the last element -*/ -template + */ +template void non_recursive_merge_sort(const Iterator first, const Iterator last) { non_recursive_merge_sort(first, last, last - first); } -/** - * @mainpage A demonstration of auto-generated documentation using Doxygen. - * Currently, it only creates output for non_recursive_merge_sort.cpp, but if - * it has proven its efficacy it can be expanded to other files. - * The configuration file is named doxy.txt and has been auto-generated too. -*/ -// the remaining of this file is only for testing. It can erased to to convert -// it into a header file for later re-use. -#include -int main(int argc, char ** argv) { + +int main(int argc, char** argv) { int size; std::cout << "Enter the number of elements : "; std::cin >> size; - int * arr = new int[size]; + int* arr = new int[size]; for (int i = 0; i < size; ++i) { std::cout << "arr[" << i << "] = "; std::cin >> arr[i]; diff --git a/sorting/numeric_string_sort.cpp b/sorting/numeric_string_sort.cpp new file mode 100644 index 000000000..04a12e71a --- /dev/null +++ b/sorting/numeric_string_sort.cpp @@ -0,0 +1,55 @@ +// Using general algorithms to sort a collection of strings results in +// alphanumeric sort. If it is a numeric string, it leads to unnatural sorting + +// eg, an array of strings 1,10,100,2,20,200,3,30,300 +// would be sorted in that same order by using conventional sorting, +// even though we know the correct sorting order is 1,2,3,10,20,30,100,200,300 + +// This Programme uses a comparator to sort the array in Numerical order instead +// of Alphanumeric order + +#include +#include +#include +#include + +bool NumericSort(std::string a, std::string b) { + while (a[0] == '0') { + a.erase(a.begin()); + } + while (b[0] == '0') { + b.erase(b.begin()); + } + int n = a.length(); + int m = b.length(); + if (n == m) + return a < b; + return n < m; +} + +int main() { + int n; + std::cout << "Enter number of elements to be sorted Numerically\n"; + std::cin >> n; + + std::vector v(n); + std::cout << "Enter the string of Numbers\n"; + for (int i = 0; i < n; i++) { + std::cin >> v[i]; + } + + sort(v.begin(), v.end()); + std::cout << "Elements sorted normally \n"; + for (int i = 0; i < n; i++) { + std::cout << v[i] << " "; + } + std::cout << "\n"; + + std::sort(v.begin(), v.end(), NumericSort); + std::cout << "Elements sorted Numerically \n"; + for (int i = 0; i < n; i++) { + std::cout << v[i] << " "; + } + + return 0; +} diff --git a/sorting/odd_even_sort.cpp b/sorting/odd_even_sort.cpp new file mode 100644 index 000000000..25f2a3712 --- /dev/null +++ b/sorting/odd_even_sort.cpp @@ -0,0 +1,53 @@ +/* C++ implementation Odd Even Sort */ +#include +#include + +using namespace std; + +void oddEven(vector &arr, int size) { + bool sorted = false; + while (!sorted) { + sorted = true; + for (int i = 1; i < size - 1; i += 2) // Odd + { + if (arr[i] > arr[i + 1]) { + swap(arr[i], arr[i + 1]); + sorted = false; + } + } + + for (int i = 0; i < size - 1; i += 2) // Even + { + if (arr[i] > arr[i + 1]) { + swap(arr[i], arr[i + 1]); + sorted = false; + } + } + } +} + +void show(vector A, int size) { + int i; + for (i = 0; i < size; i++) cout << A[i] << "\n"; +} + +int main() { + int size, temp; + cout << "\nEnter the number of elements : "; + cin >> size; + + vector arr; + + cout << "\nEnter the unsorted elements : \n"; + + for (int i = 0; i < size; ++i) { + cin >> temp; + arr.push_back(temp); + } + + oddEven(arr, size); + + cout << "Sorted array\n"; + show(arr, size); + return 0; +} diff --git a/sorting/quick_sort.cpp b/sorting/quick_sort.cpp new file mode 100644 index 000000000..1db6b014e --- /dev/null +++ b/sorting/quick_sort.cpp @@ -0,0 +1,97 @@ +/** + * @file + * @brief Quick sort algorithm + * + * Implementation Details - + * Quick Sort is a divide and conquer algorithm. It picks and element as + * pivot and partition the given array around the picked pivot. There + * are many different versions of quickSort that pick pivot in different + * ways. + * + * 1. Always pick the first element as pivot + * 2. Always pick the last element as pivot (implemented below) + * 3. Pick a random element as pivot + * 4. Pick median as pivot + * + * The key process in quickSort is partition(). Target of partition is, + * given an array and an element x(say) of array as pivot, put x at it's + * correct position in sorted array and put all smaller elements (samller + * than x) before x, and put all greater elements (greater than x) after + * x. All this should be done in linear time + * + */ + +#include +#include + +/** + * This function takes last element as pivot, places + * the pivot element at its correct position in sorted + * array, and places all smaller (smaller than pivot) + * to left of pivot and all greater elements to right + * of pivot + * + */ + +int partition(int arr[], int low, int high) { + int pivot = arr[high]; // taking the last element as pivot + int i = (low - 1); // Index of smaller element + + for (int j = low; j < high; j++) { + // If current element is smaller than or + // equal to pivot + if (arr[j] <= pivot) { + i++; // increment index of smaller element + int temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + } + int temp = arr[i + 1]; + arr[i + 1] = arr[high]; + arr[high] = temp; + return (i + 1); +} + +/** + * The main function that implements QuickSort + * arr[] --> Array to be sorted, + * low --> Starting index, + * high --> Ending index + */ +void quickSort(int arr[], int low, int high) { + if (low < high) { + int p = partition(arr, low, high); + quickSort(arr, low, p - 1); + quickSort(arr, p + 1, high); + } +} + +// prints the array after sorting +void show(int arr[], int size) { + for (int i = 0; i < size; i++) std::cout << arr[i] << " "; + std::cout << "\n"; +} + +/** Driver program to test above functions */ +int main() { + int size; + std::cout << "\nEnter the number of elements : "; + + std::cin >> size; + + int *arr = new int[size]; + + std::cout << "\nEnter the unsorted elements : "; + + for (int i = 0; i < size; ++i) { + std::cout << "\n"; + std::cin >> arr[i]; + } + quickSort(arr, 0, size); + std::cout << "Sorted array\n"; + show(arr, size); + + delete[] arr; + return 0; +} diff --git a/sorting/radix_sort.cpp b/sorting/radix_sort.cpp new file mode 100644 index 000000000..a0fbfe99e --- /dev/null +++ b/sorting/radix_sort.cpp @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +void radixsort(int a[], int n) { + int count[10]; + int* output = new int[n]; + memset(output, 0, n * sizeof(*output)); + memset(count, 0, sizeof(count)); + int max = 0; + for (int i = 0; i < n; ++i) { + if (a[i] > max) { + max = a[i]; + } + } + int maxdigits = 0; + while (max) { + maxdigits++; + max /= 10; + } + for (int j = 0; j < maxdigits; j++) { + for (int i = 0; i < n; i++) { + int t = std::pow(10, j); + count[(a[i] % (10 * t)) / t]++; + } + int k = 0; + for (int p = 0; p < 10; p++) { + for (int i = 0; i < n; i++) { + int t = std::pow(10, j); + if ((a[i] % (10 * t)) / t == p) { + output[k] = a[i]; + k++; + } + } + } + memset(count, 0, sizeof(count)); + for (int i = 0; i < n; ++i) { + a[i] = output[i]; + } + } + delete[] output; +} + +void print(int a[], int n) { + for (int i = 0; i < n; ++i) { + std::cout << a[i] << " "; + } + std::cout << std::endl; +} + +int main(int argc, char const* argv[]) { + int a[] = {170, 45, 75, 90, 802, 24, 2, 66}; + int n = sizeof(a) / sizeof(a[0]); + radixsort(a, n); + print(a, n); + return 0; +} diff --git a/sorting/selection_sort.cpp b/sorting/selection_sort.cpp new file mode 100644 index 000000000..3854f52e6 --- /dev/null +++ b/sorting/selection_sort.cpp @@ -0,0 +1,33 @@ +// Selection Sort + +#include +using namespace std; + +int main() { + int Array[6]; + cout << "\nEnter any 6 Numbers for Unsorted Array : "; + + // Input + for (int i = 0; i < 6; i++) { + cin >> Array[i]; + } + + // Selection Sorting + for (int i = 0; i < 6; i++) { + int min = i; + for (int j = i + 1; j < 6; j++) { + if (Array[j] < Array[min]) { + min = j; // Finding the smallest number in Array + } + } + int temp = Array[i]; + Array[i] = Array[min]; + Array[min] = temp; + } + + // Output + cout << "\nSorted Array : "; + for (int i = 0; i < 6; i++) { + cout << Array[i] << "\t"; + } +} diff --git a/sorting/shell_sort.cpp b/sorting/shell_sort.cpp new file mode 100644 index 000000000..eb701478d --- /dev/null +++ b/sorting/shell_sort.cpp @@ -0,0 +1,37 @@ +#include + +int main() { + int size = 10; + int* array = new int[size]; + // Input + std::cout << "\nHow many numbers do want to enter in unsorted array : "; + std::cin >> size; + std::cout << "\nEnter the numbers for unsorted array : "; + for (int i = 0; i < size; i++) { + std::cin >> array[i]; + } + + // Sorting + for (int i = size / 2; i > 0; i = i / 2) { + for (int j = i; j < size; j++) { + for (int k = j - i; k >= 0; k = k - i) { + if (array[k] < array[k + i]) { + break; + } else { + int temp = array[k + i]; + array[k + i] = array[k]; + array[k] = temp; + } + } + } + } + + // Output + std::cout << "\nSorted array : "; + for (int i = 0; i < size; ++i) { + std::cout << array[i] << "\t"; + } + + delete[] array; + return 0; +} diff --git a/sorting/shell_sort2.cpp b/sorting/shell_sort2.cpp new file mode 100644 index 000000000..59f204818 --- /dev/null +++ b/sorting/shell_sort2.cpp @@ -0,0 +1,110 @@ +#include +#include +#include +#include + +// for std::swap +#include + +template +void show_data(T *arr, size_t LEN) { + size_t i; + + for (i = 0; i < LEN; i++) std::cout << arr[i] << ", "; + std::cout << std::endl; +} + +template +void show_data(T (&arr)[N]) { + show_data(arr, N); +} + +/** + * Optimized algorithm - takes half the time by utilizing + * Mar + **/ +template +void shell_sort(T *arr, size_t LEN) { + const unsigned int gaps[] = {701, 301, 132, 57, 23, 10, 4, 1}; + const unsigned int gap_len = 8; + size_t i, j, g; + + for (g = 0; g < gap_len; g++) { + unsigned int gap = gaps[g]; + for (i = gap; i < LEN; i++) { + T tmp = arr[i]; + + for (j = i; j >= gap && (arr[j - gap] - tmp) > 0; j -= gap) + arr[j] = arr[j - gap]; + + arr[j] = tmp; + } + } +} + +template +void shell_sort(T (&arr)[N]) { + shell_sort(arr, N); +} + +/** + * function to compare sorting using cstdlib's qsort + **/ +int compare(const void *a, const void *b) { + int arg1 = *static_cast(a); + int arg2 = *static_cast(b); + + if (arg1 < arg2) + return -1; + if (arg1 > arg2) + return 1; + return 0; + + // return (arg1 > arg2) - (arg1 < arg2); // possible shortcut + // return arg1 - arg2; // erroneous shortcut (fails if INT_MIN is present) +} + +int main(int argc, char *argv[]) { + int i, NUM_DATA; + + if (argc == 2) + NUM_DATA = atoi(argv[1]); + else + NUM_DATA = 200; + + // int array = new int[NUM_DATA]; + int *data = new int[NUM_DATA]; + int *data2 = new int[NUM_DATA]; + // int array2 = new int[NUM_DATA]; + int range = 1800; + + std::srand(time(NULL)); + for (i = 0; i < NUM_DATA; i++) + data[i] = data2[i] = (std::rand() % range) - (range >> 1); + + std::cout << "Unsorted original data: " << std::endl; + show_data(data, NUM_DATA); + std::clock_t start = std::clock(); + shell_sort(data, NUM_DATA); + std::clock_t end = std::clock(); + + std::cout << std::endl + << "Data Sorted using custom implementation: " << std::endl; + show_data(data, NUM_DATA); + + double elapsed_time = (end - start) * 1.f / CLOCKS_PER_SEC; + std::cout << "Time spent sorting: " << elapsed_time << "s\n" << std::endl; + + start = std::clock(); + qsort(data2, NUM_DATA, sizeof(data2[0]), compare); + end = std::clock(); + std::cout << "Data Sorted using cstdlib qsort: " << std::endl; + show_data(data2, NUM_DATA); + + elapsed_time = (end - start) * 1.f / CLOCKS_PER_SEC; + std::cout << "Time spent sorting: " << elapsed_time << "s\n" << std::endl; + + free(data); + free(data2); + return 0; +} diff --git a/sorting/slow_sort.cpp b/sorting/slow_sort.cpp new file mode 100644 index 000000000..a3e64dba0 --- /dev/null +++ b/sorting/slow_sort.cpp @@ -0,0 +1,56 @@ +// Returns the sorted vector after performing SlowSort +// It is a sorting algorithm that is of humorous nature and not useful. +// It's based on the principle of multiply and surrender, a tongue-in-cheek joke +// of divide and conquer. It was published in 1986 by Andrei Broder and Jorge +// Stolfi in their paper Pessimal Algorithms and Simplexity Analysis. This +// algorithm multiplies a single problem into multiple subproblems It is +// interesting because it is provably the least efficient sorting algorithm that +// can be built asymptotically, and with the restriction that such an algorithm, +// while being slow, must still all the time be working towards a result. + +#include + +void SlowSort(int a[], int i, int j) { + if (i >= j) + return; + int m = i + (j - i) / 2; // midpoint, implemented this way to avoid + // overflow + int temp; + SlowSort(a, i, m); + SlowSort(a, m + 1, j); + if (a[j] < a[m]) { + temp = a[j]; // swapping a[j] & a[m] + a[j] = a[m]; + a[m] = temp; + } + SlowSort(a, i, j - 1); +} + +// Sample Main function + +int main() { + int size; + std::cout << "\nEnter the number of elements : "; + + std::cin >> size; + + int *arr = new int[size]; + + std::cout << "\nEnter the unsorted elements : "; + + for (int i = 0; i < size; ++i) { + std::cout << "\n"; + std::cin >> arr[i]; + } + + SlowSort(arr, 0, size); + + std::cout << "Sorted array\n"; + + for (int i = 0; i < size; ++i) { + std::cout << arr[i] << " "; + } + + delete[] arr; + return 0; +} diff --git a/sorting/swap_sort.cpp b/sorting/swap_sort.cpp index a4ab1e57b..4cdaa57b3 100644 --- a/sorting/swap_sort.cpp +++ b/sorting/swap_sort.cpp @@ -10,7 +10,7 @@ int minSwaps(int arr[], int n) { // Create an array of pairs where first // element is array element and second element // is position of first element - std::pair arrPos[n]; + std::pair *arrPos = new std::pair[n]; for (int i = 0; i < n; i++) { arrPos[i].first = arr[i]; arrPos[i].second = i; @@ -53,6 +53,8 @@ int minSwaps(int arr[], int n) { } } + delete[] arrPos; + // Return result return ans; } diff --git a/sorting/Tim Sort.cpp b/sorting/tim_sort.cpp similarity index 55% rename from sorting/Tim Sort.cpp rename to sorting/tim_sort.cpp index 14d3a04d0..94f5aa230 100644 --- a/sorting/Tim Sort.cpp +++ b/sorting/tim_sort.cpp @@ -1,115 +1,103 @@ // C++ program to perform TimSort. +#include #include -using namespace std; + const int RUN = 32; - -// this function sorts array from left index to to right index which is of size atmost RUN -void insertionSort(int arr[], int left, int right) -{ - for (int i = left + 1; i <= right; i++) - { + +// this function sorts array from left index to to right index which is of size +// atmost RUN +void insertionSort(int arr[], int left, int right) { + for (int i = left + 1; i <= right; i++) { int temp = arr[i]; int j = i - 1; - while (arr[j] > temp && j >= left) - { - arr[j+1] = arr[j]; + while (arr[j] > temp && j >= left) { + arr[j + 1] = arr[j]; j--; } - arr[j+1] = temp; + arr[j + 1] = temp; } } - + // merge function merges the sorted runs -void merge(int arr[], int l, int m, int r) -{ +void merge(int arr[], int l, int m, int r) { // original array is broken in two parts, left and right array int len1 = m - l + 1, len2 = r - m; - int left[len1], right[len2]; - for (int i = 0; i < len1; i++) - left[i] = arr[l + i]; - for (int i = 0; i < len2; i++) - right[i] = arr[m + 1 + i]; - + int *left = new int[len1], *right = new int[len2]; + for (int i = 0; i < len1; i++) left[i] = arr[l + i]; + for (int i = 0; i < len2; i++) right[i] = arr[m + 1 + i]; + int i = 0; int j = 0; int k = l; - + // after comparing, we merge those two array in larger sub array - while (i < len1 && j < len2) - { - if (left[i] <= right[j]) - { + while (i < len1 && j < len2) { + if (left[i] <= right[j]) { arr[k] = left[i]; i++; - } - else - { + } else { arr[k] = right[j]; j++; } k++; } - + // copy remaining elements of left, if any - while (i < len1) - { + while (i < len1) { arr[k] = left[i]; k++; i++; } - + // copy remaining element of right, if any - while (j < len2) - { + while (j < len2) { arr[k] = right[j]; k++; j++; } + delete[] left; + delete[] right; } - + // iterative Timsort function to sort the array[0...n-1] (similar to merge sort) -void timSort(int arr[], int n) -{ +void timSort(int arr[], int n) { // Sort individual subarrays of size RUN - for (int i = 0; i < n; i+=RUN) - insertionSort(arr, i, min((i+31), (n-1))); - - // start merging from size RUN (or 32). It will merge to form size 64, then 128, 256 and so on .... - for (int size = RUN; size < n; size = 2*size) - { - // pick starting point of left sub array. We are going to merge arr[left..left+size-1] and arr[left+size, left+2*size-1] - // After every merge, we increase left by 2*size - for (int left = 0; left < n; left += 2*size) - { + for (int i = 0; i < n; i += RUN) + insertionSort(arr, i, std::min((i + 31), (n - 1))); + + // start merging from size RUN (or 32). It will merge to form size 64, then + // 128, 256 and so on .... + for (int size = RUN; size < n; size = 2 * size) { + // pick starting point of left sub array. We are going to merge + // arr[left..left+size-1] and arr[left+size, left+2*size-1] After every + // merge, we increase left by 2*size + for (int left = 0; left < n; left += 2 * size) { // find ending point of left sub array // mid+1 is starting point of right sub array int mid = left + size - 1; - int right = min((left + 2*size - 1), (n-1)); - + int right = std::min((left + 2 * size - 1), (n - 1)); + // merge sub array arr[left.....mid] & arr[mid+1....right] merge(arr, left, mid, right); } } } - + // utility function to print the Array -void printArray(int arr[], int n) -{ - for (int i = 0; i < n; i++) - printf("%d ", arr[i]); - printf("\n"); +void printArray(int arr[], int n) { + for (int i = 0; i < n; i++) printf("%d ", arr[i]); + std::cout << std::endl; } - + // Driver program to test above function -int main() -{ +int main() { int arr[] = {5, 21, 7, 23, 19}; - int n = sizeof(arr)/sizeof(arr[0]); + int n = sizeof(arr) / sizeof(arr[0]); printf("Given Array is\n"); printArray(arr, n); - + timSort(arr, n); - + printf("After Sorting Array is\n"); printArray(arr, n); return 0; diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt new file mode 100644 index 000000000..3c15695cc --- /dev/null +++ b/strings/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/strings") + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/strings/brute_force_string_searching.cpp b/strings/brute_force_string_searching.cpp index 3288b36b0..9a2b5327a 100644 --- a/strings/brute_force_string_searching.cpp +++ b/strings/brute_force_string_searching.cpp @@ -1,52 +1,53 @@ -#include -#include -#include - -using std::string; - -int brute_force(string text, string pattern); -std::vector> test_set = { - // {text, pattern, expected output} - {"a", "aa", "-1"}, - {"a", "a", "0"}, - {"ba", "b", "0"}, - {"bba", "bb", "0"}, - {"bbca", "c", "2"}, - {"ab", "b", "1"} -}; - -int main() { - for (size_t i = 0 ; i < test_set.size(); i++) { - int output = brute_force(test_set[i][0], test_set[i][1]); - if (std::to_string(output) == test_set[i][2]) - std::cout << "success\n"; - else - std::cout << "failure\n"; - } - return 0; -} - -/* - *@description Find a pattern in a string by comparing the pattern - * to every substring. - *@param text Any string that might contain the pattern. - *@param pattern String that we are searching for. - *@return Index where the pattern starts in the text or - * -1 if the pattern was not found. +/** + * @file + * @brief String pattern search - brute force */ +#include +#ifdef _MSC_VER +#include // use this for MS Visucal C++ +#else +#include +#endif +#include -int brute_force(string text, string pattern) { - size_t pat_l = pattern.length(); - size_t txt_l = text.length(); - int index = -1; - if (pat_l <= txt_l) { - for (size_t i = 0; i < txt_l-pat_l+1; i++) { - string s = text.substr(i, pat_l); - if (s == pattern) { - index = i; +/** + * Find a pattern in a string by comparing the pattern to every substring. + * @param text Any string that might contain the pattern. + * @param pattern String that we are searching for. + * @return Index where the pattern starts in the text + * @return -1 if the pattern was not found. + */ +int brute_force(const std::string &text, const std::string &pattern) { + size_t pat_l = pattern.length(); + size_t txt_l = text.length(); + int index = -1; + if (pat_l <= txt_l) { + for (size_t i = 0; i < txt_l - pat_l + 1; i++) { + std::string s = text.substr(i, pat_l); + if (s == pattern) { + index = i; break; } } } return index; } + +/** set of test cases */ +const std::vector> test_set = { + // {text, pattern, expected output} + {"a", "aa", "-1"}, {"a", "a", "0"}, {"ba", "b", "0"}, + {"bba", "bb", "0"}, {"bbca", "c", "2"}, {"ab", "b", "1"}}; + +/** Main function */ +int main() { + for (size_t i = 0; i < test_set.size(); i++) { + int output = brute_force(test_set[i][0], test_set[i][1]); + + if (std::to_string(output) == test_set[i][2]) + std::cout << "success\n"; + else + std::cout << "failure\n"; + } + return 0; +} diff --git a/strings/knuth_morris_pratt.cpp b/strings/knuth_morris_pratt.cpp index f6f1169d3..b83cab966 100644 --- a/strings/knuth_morris_pratt.cpp +++ b/strings/knuth_morris_pratt.cpp @@ -1,64 +1,88 @@ -/* - The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text - with complexity O(n + m) - 1) Preprocess pattern to identify any suffixes that are identical to prefixes - This tells us where to continue from if we get a mismatch between a character in our pattern - and the text. - 2) Step through the text one character at a time and compare it to a character in the pattern - updating our location within the pattern if necessary -*/ +/** + * \file + * \brief The [Knuth-Morris-Pratt + * Algorithm](https://en.wikipedia.org/wiki/Knuth–Morris–Pratt_algorithm) for + * finding a pattern within a piece of text with complexity O(n + m) + * + * 1. Preprocess pattern to identify any suffixes that are identical to + * prefixes. This tells us where to continue from if we get a mismatch between a + * character in our pattern and the text. + * 2. Step through the text one character at a time and compare it to a + * character in the pattern updating our location within the pattern if + * necessary + */ -#include -#include -#include -using namespace std; -vector getFailureArray(string pattern){ - int pattern_length=pattern.size(); - vectorfailure(pattern_length+1); - failure[0]=-1; - int j=-1; - for(int i=0; i +#ifdef _MSC_VER +#include // use this for MS Visucal C++ +#else +#include +#endif +#include + +/** + * Generate the partial match table aka failure function for a pattern to + * search. + * \param[in] pattern text for which to create the partial match table + * \returns the partial match table as a vector array + */ +std::vector getFailureArray(const std::string &pattern) { + int pattern_length = pattern.size(); + std::vector failure(pattern_length + 1); + failure[0] = -1; + int j = -1; + + for (int i = 0; i < pattern_length; i++) { + while (j != -1 && pattern[j] != pattern[i]) { + j = failure[j]; } j++; - failure[i+1]=j; + failure[i + 1] = j; } return failure; } -bool kmp(string pattern,string text){ - int text_length=text.size(),pattern_length=pattern.size(); - vectorfailure=getFailureArray(pattern); - int k=0; - for(int j=0; j failure = getFailureArray(pattern); + + int k = 0; + for (int j = 0; j < text_length; j++) { + while (k != -1 && pattern[k] != text[j]) { + k = failure[k]; } k++; - if(k==pattern_length)return true; + if (k == pattern_length) + return true; } return false; } -int main() -{ - - string text="alskfjaldsabc1abc1abc12k23adsfabcabc"; - string pattern="abc1abc12l"; - if(kmp(pattern,text)==true){ - cout<<"Found"< -#include -#include -#include +#include +#include +#include +#ifdef _MSC_VER +#include // use this for MS Visucal C++ +#else +#include +#endif -using std::string; -using std::pow; +#define PRIME 5 ///< Prime modulus for hash functions -#define PRIME 5 - -int64_t create_hash(string s , int n) { +/** + * convert a string to an intger - called as hashing function + * \param[in] s source of string to hash + * \param[in] n length of substring to hash + * \returns hash integer + */ +int64_t create_hash(const std::string& s, int n) { int64_t result = 0; - for ( int i = 0; i < n; ++i ) { - result += (int64_t)(s[i] * (int64_t)pow(PRIME , i)); + for (int i = 0; i < n; ++i) { + result += (int64_t)(s[i] * (int64_t)pow(PRIME, i)); } return result; } -int64_t recalculate_hash(string s , int old_index , - int new_index , int64_t old_hash , int patLength) { +/** + * re-hash a string using known existing hash + * \param[in] s source of string to hash + * \param[in] old_index previous index of string + * \param[in] new_index new index of string + * \param[in] old_hash previous hash of substring + * \param[in] patLength length of substring to hash + * \returns new hash integer + */ +int64_t recalculate_hash(const std::string& s, int old_index, int new_index, + int64_t old_hash, int patLength) { int64_t new_hash = old_hash - s[old_index]; new_hash /= PRIME; - new_hash += (int64_t)(s[new_index]*(int64_t)pow(PRIME, patLength-1)); + new_hash += (int64_t)(s[new_index] * (int64_t)pow(PRIME, patLength - 1)); return new_hash; } -bool check_if_equal(string str1 , string str2 , - int start1 , int end1 , - int start2 , int end2) { - if (end1-start1 != end2-start2) { +/** + * compare if two sub-strings are equal + * \param[in] str1 string pattern to search + * \param[in] str2 text in which to search + * \param[in] start1,end1 start and end indices for substring in str1 + * \param[in] start2,end2 start and end indices for substring in str2 + * \returns `true` if pattern was found + * \returns `false` if pattern was not found + * @note can this be replaced by std::string::compare? + */ +bool check_if_equal(const std::string& str1, const std::string& str2, + int start1, int end1, int start2, int end2) { + if (end1 - start1 != end2 - start2) { return false; } while (start1 <= end1 && start2 <= end2) { @@ -46,33 +71,36 @@ bool check_if_equal(string str1 , string str2 , return true; } -/* - * @description : search pattern in the given text - * @param : string str - * @param : string pat - * @return index of first occurrence of pattern or -1 if pattern not found +/** + * Perform string pattern search using Rabin-Karp algorithm + * @param[in] str string to search in + * @param[in] pat pattern to search for + * @return index of first occurrence of pattern + * @return -1 if pattern not found */ -int rabin_karp(const string &str , const string& pat) { - int64_t pat_hash = create_hash(pat , pat.size()); - int64_t str_hash = create_hash(str , pat.size()); - for (int i=0; i <= str.size()-pat.size(); ++i) { +int rabin_karp(const std::string& str, const std::string& pat) { + int64_t pat_hash = create_hash(pat, pat.size()); + int64_t str_hash = create_hash(str, pat.size()); + for (int i = 0; i <= str.size() - pat.size(); ++i) { if (pat_hash == str_hash && - check_if_equal(str , pat , i , i+pat.size()-1 , 0 , pat.size()-1)) { - return i; + check_if_equal(str, pat, i, i + pat.size() - 1, 0, + pat.size() - 1)) { + return i; } - if (i < str.size()-pat.size()) { + if (i < str.size() - pat.size()) { str_hash = - recalculate_hash(str, i, i+pat.size(), str_hash, pat.size()); + recalculate_hash(str, i, i + pat.size(), str_hash, pat.size()); } } return -1; // return -1 if given pattern not found } +/** Main function */ int main(void) { - assert(rabin_karp("helloWorld", "world") == -1); - assert(rabin_karp("helloWorld", "World") == 5); - assert(rabin_karp("this_is_c++" , "c++") == 8); - assert(rabin_karp("happy_coding", "happy") == 0); + assert(rabin_karp("helloWorld", "world") == -1); + assert(rabin_karp("helloWorld", "World") == 5); + assert(rabin_karp("this_is_c++", "c++") == 8); + assert(rabin_karp("happy_coding", "happy") == 0); return 0; }