C++ 算法大全
Go to file
Piotr Idzik e2bf654e82
[feat/fix]: improve the data stack implementations (#2235)
* fix: remove memory leak in stack

* style: use camelCase

* style: simplify logic

* style: rename stack.h to stack.hpp

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for 2205c6f1

* fix: remove redundant file name

Co-authored-by: David Leal <halfpacho@gmail.com>

* clang-format and clang-tidy fixes for a080aaa2

* refactor: use std::shared_ptr

* fix: use C++11

* chore: synchronize with master (#2)

* chore: fix Markdown formatting in `dynamic_programming/kadane2.cpp` (#2276)

* docs: fix grammatical errors and typos (#2201)

* docs: fix grammatical errors and typos

* compilation error fixed

* Revert "compilation error fixed"

This reverts commit 0083cbfd1a.

* feat: added physics directory and ground to ground projectile motion algorithm (#2279)

* feat: added physics folder, ground to ground projectile motion calculations

* feat: added max height function

* fix: bug in angle calculations

* test: added test cases

* docs: added comments to test case variables

* docs: added comments to calculations

* fix: changed floats to doubles

* updating DIRECTORY.md

* Update physics/ground_to_ground_projectile_motion.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* chore: add missing namespace

* rerun checks

Co-authored-by: David <Panquesito7@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>

* docs: updated a logically wrong doc comment (#2329)

* feat: add CMakeLists to the `divide_and_conquer` directory (#2072)

* fix: stairs pattern not printing slash (#2111)

when we propose 2 backslash then it doesn't take it as a comment and gets printed

Co-authored-by: David Leal <halfpacho@gmail.com>

* fix: use FreeGlut newest GitHub link (#2397)

* updating DIRECTORY.md

* fix: use FreeGlut newest GitHub link

* chore(fix): `data_strcutres` -> `data_structures` (#2399)

* feat: add Find non repeating number implementation (#2061)

* add find_single_number

* add fix issues

* remove .vscode

* add .vscode

* Update .vscode/settings.json

Co-authored-by: David Leal <halfpacho@gmail.com>

* chore(fix): minor issues

Co-authored-by: David Leal <halfpacho@gmail.com>

* [feat/docs]: improve the `quick_sort.cpp` algorithm (#2396)

* [feat/docs]: improve the `quick_sort.cpp`...

...algorithm implementation.

* clang-format and clang-tidy fixes for 40c858ba

* chore(fix): add original author

* updating DIRECTORY.md

* chore: update Discord links (#2407)

* docs: remove unneeded Markdown header

* feat: improve the Awesome Workflow (#2408)

* fix: Awesome Workflow issues

Thanks to @tjgurwara99 for the original fix: TheAlgorithms/C#1176

* chore: apply suggestions from code review

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* feat: various improvements

* chore: apply suggestions from code review

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* chore: remove LGTM and fix...

...CodeQL badges.

* docs: add guide on integrating CMake (#2410)

Taken from TheAlgorithms/C#1163

* updating DIRECTORY.md

Co-authored-by: Daemon <90456722+Daemon19@users.noreply.github.com>
Co-authored-by: aadarshkt <72285744+aadarshkt@users.noreply.github.com>
Co-authored-by: Focus <65309793+Focusucof@users.noreply.github.com>
Co-authored-by: David <Panquesito7@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Arjit Malik <arjitmalik2001@gmail.com>
Co-authored-by: Harsh Singh <94822101+harshsingh510@users.noreply.github.com>
Co-authored-by: Ravi Dev Pandey <62198564+literalEval@users.noreply.github.com>
Co-authored-by: Mehmet <110852769+walterwhite351@users.noreply.github.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>

* docs: update authors and include comments

apply suggestions of @Panquesito7

Co-authored-by: David Leal <halfpacho@gmail.com>

* style: apply clang-format

* clang-format and clang-tidy fixes for b35b7214

* style: make display and isEmptyStack const

* tests: remove test_stack_legacy.cpp

* style: throw invalid_argument from top and pop if stack empty

* updating DIRECTORY.md

* style: add missing include docs, remove cassert

* style: use assert macro, document includes

* fix: use const reference in lambdas in display and toVector

* style: remove shared_ptr from traverse

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Daemon <90456722+Daemon19@users.noreply.github.com>
Co-authored-by: aadarshkt <72285744+aadarshkt@users.noreply.github.com>
Co-authored-by: Focus <65309793+Focusucof@users.noreply.github.com>
Co-authored-by: Arjit Malik <arjitmalik2001@gmail.com>
Co-authored-by: Harsh Singh <94822101+harshsingh510@users.noreply.github.com>
Co-authored-by: Ravi Dev Pandey <62198564+literalEval@users.noreply.github.com>
Co-authored-by: Mehmet <110852769+walterwhite351@users.noreply.github.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-01-10 09:32:09 -06:00
.github feat: improve the Awesome Workflow (#2408) 2022-12-16 16:52:48 -06:00
.vscode feat: Created composite Simpson's numerical integration method (#1773) 2021-11-03 12:22:08 -06:00
backtracking fix: Sudoku Solver algorithm filename 2022-08-24 19:29:21 -05:00
bit_manipulation feat: add Find non repeating number implementation (#2061) 2022-11-27 23:11:43 -06:00
ciphers fix: CodeQL warnings (#1827) 2021-11-07 11:49:33 -06:00
cpu_scheduling_algorithms feat: Added implementation of FCFS CPU scheduling algorithm (#1684) 2021-10-15 11:34:00 -05:00
data_structures [feat/fix]: improve the data stack implementations (#2235) 2023-01-10 09:32:09 -06:00
divide_and_conquer feat: add CMakeLists to the divide_and_conquer directory (#2072) 2022-10-28 19:56:45 -05:00
doc Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
dynamic_programming docs: fix grammatical errors and typos (#2201) 2022-10-18 16:02:47 -05:00
geometry feat: Added Graham Scan Algorithm. (#1836) 2021-11-14 10:56:46 -06:00
graph feat: Created midpoint integration numerical method (#1785) 2021-11-01 07:56:40 -06:00
graphics fix: use FreeGlut newest GitHub link (#2397) 2022-11-23 22:17:17 -06:00
greedy_algorithms feat: Add ncr mod p code (#1325) 2020-11-22 23:05:01 +05:30
hashing feat. Add SHA-1 hashing algorithm (#1609) 2021-09-24 14:59:26 -05:00
machine_learning [feat/fix]: A Star Search Improvement (#1566) 2021-08-27 12:50:40 -05:00
math feat: add modular_inverse_simple (#1937) 2022-06-09 10:27:12 -05:00
numerical_methods feat: move gram_schmidt to numerical_methods (#1940) 2022-06-09 10:09:03 -05:00
operations_on_datastructures fix: Circular linked list (#1825) 2021-11-02 11:03:49 -06:00
others fix: stairs pattern not printing slash (#2111) 2022-11-18 15:24:39 -06:00
physics feat: added physics directory and ground to ground projectile motion algorithm (#2279) 2022-10-26 03:01:34 +05:30
probability feat: Modify search/text_search.cpp (#1662) 2021-10-14 13:34:55 -05:00
range_queries feat: Reworked/updated sorting/selection_sort.cpp. (#1613) 2021-10-25 13:17:33 -05:00
search feat: add new Median Search implementation (#1992) 2022-09-26 11:28:55 -05:00
sorting [feat/docs]: improve the quick_sort.cpp algorithm (#2396) 2022-12-01 11:29:28 -06:00
strings feat: add binary_insertion_sort (#1850) 2022-01-11 12:39:41 -06:00
.clang-format [bug fix] fix code formatting in CI (#1052) 2020-08-26 10:48:08 -04:00
.clang-tidy [code fix] Fixed trie_tree for code quality and docs & clang-tidy error check (#1059) 2020-08-27 12:30:14 -04:00
.gitignore Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
.gitpod.dockerfile install freeglut3-dev (#973) 2020-07-23 15:51:48 -04:00
.gitpod.yml fix: remove the ms-vscode.cpptools extension 2021-11-05 18:39:50 -06:00
CMakeLists.txt feat: add CMakeLists to the divide_and_conquer directory (#2072) 2022-10-28 19:56:45 -05:00
CODE_OF_CONDUCT.md fix: Update the CoC to match the .github repository (#1832) 2021-10-31 21:05:51 -06:00
CodingGuidelines.md [feat/fix]: Improve the contributing guidelines... (#1522) 2021-07-05 22:02:33 -05:00
CONTRIBUTING.md docs: add guide on integrating CMake (#2410) 2022-12-21 10:37:27 -06:00
DIRECTORY.md [feat/fix]: improve the data stack implementations (#2235) 2023-01-10 09:32:09 -06:00
LICENSE chore: update copyright notices to 2022 2022-09-07 19:12:34 -05:00
README.md chore: remove LGTM and fix... 2022-12-16 19:40:18 -06:00
REVIEWER_CODE.md feat: guidelines for reviewers (#1302) 2020-10-16 16:18:38 -04:00

The Algorithms - C++

Gitpod Ready-to-Code CodeQL CI Gitter chat contributions welcome GitHub repo size Doxygen CI Awesome CI Income Discord chat Donate

Overview

This repository is a collection of open-source implementation of a variety of algorithms implemented in C++ and licensed under MIT License. These algorithms span a variety of topics from computer science, mathematics and statistics, data science, machine learning, engineering, etc.. The implementations and the associated documentation are meant to provide a learning resource for educators and students. Hence, one may find more than one implementation for the same objective but using a different algorithm strategies and optimizations.

Features

  • The repository provides implementations of various algorithms in one of the most fundamental general purpose languages - C++.
  • Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
  • Each source code is atomic using STL classes and no external libraries are required for their compilation and execution. Thus, the fundamentals of the algorithms can be studied in much depth.
  • Source codes are compiled and tested for every commit on the latest versions of three major operating systems viz., Windows, MacOS and Ubuntu (Linux) using MSVC 16 2019, AppleClang 11.0 and GNU 7.5.0 respectively.
  • Strict adherence to C++11 standard ensures portability of code to embedded systems as well like ESP32, ARM Cortex, etc. with little to no changes.
  • Self-checks within programs ensure correct implementations with confidence.
  • Modular implementations and OpenSource licensing enable the functions to be utilized conveniently in other applications.

Documentation

Online Documentation is generated from the repository source codes directly. The documentation contains all resources including source code snippets, details on execution of the programs, diagrammatic representation of program flow, and links to external resources where necessary. The documentation also introduces interactive source code with links to documentation for C++ STL library functions used. Click on Files menu to see the list of all the files documented with the code.

Documentation of Algorithms in C++ by The Algorithms Contributors is licensed under CC BY-SA 4.0
Creative Commons LicenseCredit must be given to the creatorAdaptations must be shared under the same terms

Contributions

As a community developed and maintained repository, we welcome new un-plagiarized quality contributions. Please read our Contribution Guidelines.