Commit Graph

1615 Commits

Author SHA1 Message Date
futoid
77445edce2 Merge branch 'TheAlgorithms:master' into temp 2023-04-06 10:52:46 +05:30
Piotr Idzik
65efd47bc1 fix: remove memory leak in reverse_a_linked_list.cpp (#2439)
* style: remove unused header

* fix: add destructor to list

* style: add missing constructors, make some methods const

* fix: google-readability-braces-around-statements

* fix: suppress some warnings

* docs: remove meaningless documentation

* docs: add missing documentation

* style: check if isEmpty in copy_all_nodes_from_list

* style: declare variables in seperate lines

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-03-30 14:19:26 -06:00
David Leal
1d2c5d9d97 feat: add Sieve of Eratosthenes (originally by @thechubbypanda) (#2442)
* feat: add Sieve of Eratosthenes

Originally created by @thechubbypanda.

* updating DIRECTORY.md

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: Keval Kapdee <keval@thechubbypanda.net>
2023-03-29 14:24:13 -06:00
futoid
6280bc6196 Update math/finding_number_of_digits_in_a_number.cpp
typo changes

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-03-03 09:33:20 +05:30
futoid
bf0c06bcce Update math/finding_number_of_digits_in_a_number.cpp
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-03-03 09:32:37 +05:30
Suman Mondal
0f20cdcf8f feat: add maximum circular subarray sum (#2242)
* Create maximum_circular_subarray.cpp

* Delete maximum_circular_subarray.cpp

* Create maximum_circular_subarray.cpp

* Update maximum_circular_subarray.cpp

Used the template provided.

* updating DIRECTORY.md

* Update maximum_circular_subarray.cpp

* Update maximum_circular_subarray.cpp

* Update maximum_circular_subarray.cpp

* Update maximum_circular_subarray.cpp

* Update maximum_circular_subarray.cpp

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update maximum_circular_subarray.cpp

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update dynamic_programming/maximum_circular_subarray.cpp

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

* Update maximum_circular_subarray.cpp

Fixed the comments according to @krishnacx

* chore: apply suggestions from code review

---------

Co-authored-by: Suman Mondal <94859440+sumanarlert@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-06 14:11:52 -06:00
Piotr Idzik
cc33efd3b6 [fix/feat]: remove memory leak in avltree.cpp (#2429)
* fix: remove memory leak by adding deleteAllNodes

* clang-format and clang-tidy fixes for 9d76f8bd

* docs: explain usage of standard headers

* docs: use doxygen syntax

* docs: document parameters of the functions

* style: use proper spelling

* style: simplify logic in deleteNode

* docs: add missing [in]

* docs: add missing slashes

* docs: document `main`

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

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for c852f62d

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-03 18:40:26 -06:00
Prafful Gupta
dc8ecfbf50 feat: add power of two algorithm (#2224)
* feat: add power_of_two.cpp

* chore: minor changes

* fix: Windows CI issues

* chore: remove unnecessary namespace

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-03 15:12:19 -06:00
Luiz Carlos Cosmi Filho
a8af29bf65 feat: add k-nearest neighbors algorithm (#2416)
* feat: add k-nearest neighbors, class Knn

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for 8dfacfdf

* fix: comments in k-nearest neighbors

* test: add more tests for k-nearest-neighbors algorithm

* fix: description of k-nearest neighbors algorithm

* chore: apply suggestions from code review

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-31 13:47:26 -06:00
David Leal
b89d1da2f1 chore: update FreeGLUT to v3.2.2 (#2432) 2023-01-31 10:20:47 -06:00
futoid
e5e9f8cd8f decoupled test functions 2023-01-28 00:14:56 +05:30
futoid
4e25539fe4 Merge branch 'TheAlgorithms:master' into temp 2023-01-27 23:59:34 +05:30
Piotr Idzik
7c090481da [fix/docs]: remove memory leak in queue (#2417)
* fix: remove memory leak in queue

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for effd74c9

* style: simplify logic while using reserve

* style: use value_type as return type in front

* style: use proper error message

* style: use pre-increment and pre-decrement

* docs: use doxygen syntax

* docs: improve wording

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-26 00:29:37 -06:00
Ashish Bhanu Daulatabad
5b238724b8 feat: add Strassen's Matrix Multiplication (#2413)
* Feat: Add Strassen's matrix multiplication

* updating DIRECTORY.md

* Fix cpp lint error

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for 02439b57

* Fix windows error

* Add namespaces

* updating DIRECTORY.md

* Proper documentation

* Reduce the matrix size.

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for 0545555a

Co-authored-by: toastedbreadandomelette <toastedbreadandomelette@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-24 14:03:06 -06:00
KillerAV
a6a9d8e75a feat: add Subset Sum (#2020)
* Create subset_sum.cpp

* Update subset_sum.cpp

Lint formatting.

* chore: apply suggestions from code review

* chore: apply suggestions from code review

* fix: CI issues

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-24 13:55:55 -06:00
Jason
f093837c78 feat: add Boruvkas Algorithm (#1984)
* Boruvkas Algorithm Implementation

Implemented Boruvkas Algorithm under graphs as a means for finding the minimums spanning tree

* Boruvkas Algorithm Implementation

Implemented Boruvkas algorithm, a greedy algorithm to find a graphs minimum spanning tree.

* Update climits

limits.h to climits

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

* Fixes for maintainability

Made changes as recommended by Panquesito7 for maintainability and security

* Fixed boruvkas main

Made suggested changes

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

* Suggested changes for Boruvkas

Changed from graph to greedy algorithm, removed the extra main(), general fixes

* Update Boruvkas readability, CI Workflow

General readability changes, change push_back to implace_back

* Update Boruvkas memory allocation

Added pre-allocation of memory for the parent vector of Boruvkas

* Fixed file name, added namespace

Fixed file name, added Boruvkas namespace, made suggested changes

* Update boruvkas spacing

Fixed spacing hopefully

* Update boruvkas spacing

Fixing weird tabs

* Update Boruvkas tabs spacings

Finally done with spacing i think

* Boruvkas - Finished spacing

Triplle checked tabs/spaces

* chore: apply suggestions from code review

* fix: CI issues (hopefully)

* fix: last fix

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-24 13:53:25 -06:00
Defective Detective
249ba8877d feat: Add aliquot sum of a number algorithm, class Math (#2400)
* Added aliquot_sum.cpp

* Fixed indentation and changed argument to ull int

* Fixed type of I

* Made parameter as const

* Made some required changes

* Added changes due to namespace

* Formatting changes

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-22 14:42:58 -06:00
Utkarsh Yadav
0931d530ae feat: Added Travelling Salesman Problem using bit-manipulation (#2136)
* adding travelling_salesman problem using bitmanipulation

* listing travelling_salesman problem in directory.md file

* adding requested changes

* updating DIRECTORY.md

* chore: apply suggestions from code review

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-01-22 13:39:03 -06:00
David Leal
bc8bd61d10 fix: revert for now 2023-01-13 20:03:09 +00:00
David Leal
4dcdd22f33 fix: CI warnings (hopefully) 2023-01-13 19:38:34 +00:00
David Leal
b3e3e3b2ca Merge branch 'master' into temp 2023-01-13 11:44:56 -06:00
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
David Leal
addb3b408f Merge branch 'master' into temp 2022-12-30 00:35:56 -06:00
David Leal
582cdc7cc4 docs: add guide on integrating CMake (#2410)
Taken from TheAlgorithms/C#1163
2022-12-21 10:37:27 -06:00
David Leal
18f6cef2ad chore: remove LGTM and fix...
...CodeQL badges.
2022-12-16 19:40:18 -06:00
David Leal
04a1ab0b98 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>
2022-12-16 16:52:48 -06:00
David Leal
9ef438f788 docs: remove unneeded Markdown header 2022-12-16 15:20:37 -06:00
Mehmet
85bc5188bd chore: update Discord links (#2407) 2022-12-16 14:49:48 -06:00
futoid
570e8a8a77 one space removed 2022-12-06 17:20:55 +00:00
futoid
af3c7de8d5 Merge branch 'TheAlgorithms:master' into temp 2022-12-06 22:44:37 +05:30
David Leal
1371b5390a [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
2022-12-01 11:29:28 -06:00
David Leal
f71ac8b50e Merge branch 'master' into temp 2022-11-29 14:15:33 -06:00
Ravi Dev Pandey
e5ca4773e9 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>
2022-11-27 23:11:43 -06:00
David Leal
8cc4433050 chore(fix): data_strcutres -> data_structures (#2399) 2022-11-25 18:49:18 -06:00
David Leal
d0f7f230ca fix: use FreeGlut newest GitHub link (#2397)
* updating DIRECTORY.md

* fix: use FreeGlut newest GitHub link
2022-11-23 22:17:17 -06:00
Harsh Singh
34720ae2d3 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>
2022-11-18 15:24:39 -06:00
David Leal
3b4d1421d3 feat: add CMakeLists to the divide_and_conquer directory (#2072) 2022-10-28 19:56:45 -05:00
Arjit Malik
969b447773 docs: updated a logically wrong doc comment (#2329) 2022-10-25 19:55:21 -05:00
Focus
0fea073413 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>
2022-10-26 03:01:34 +05:30
aadarshkt
ee9835378f docs: fix grammatical errors and typos (#2201)
* docs: fix grammatical errors and typos

* compilation error fixed

* Revert "compilation error fixed"

This reverts commit 0083cbfd1a.
2022-10-18 16:02:47 -05:00
Daemon
f0b35b657a chore: fix Markdown formatting in dynamic_programming/kadane2.cpp (#2276) 2022-10-16 23:02:37 -05:00
David Leal
59a0d3a069 docs: improve the bug report issue template (#2206) 2022-10-13 10:42:07 -05:00
futoid
8447bff622 added log code for counting digits 2022-10-12 21:53:04 +05:30
Ameer Carlo Lubang
97c7d91878 fix: karatsuba's algorithm is not compiling (#2115)
* fix: karatsuba's algorithm is not compiling
doc: improved comments

* fix: continuous integration issues

Co-authored-by: David Leal <halfpacho@gmail.com>
2022-10-05 22:48:56 +05:30
David Leal
84ff18e0ac fix: quick_sort_3.cpp warning (#2070)
* fix: `quick_sort_3.cpp` warning

* clang-format and clang-tidy fixes for d95ac026
2022-10-04 10:06:15 -05:00
Mohammed Faizan Ahmed
24f68ea4db fix: broken link in the contributing guidelines (#2067) 2022-10-02 11:40:31 -05:00
David Leal
c1f17927aa chore: minor Markdown improvements 2022-09-29 14:26:13 -05:00
Chen Tao
1772ee06cc fix: ARM GCC compiler error (#1952)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-09-27 12:24:33 -05:00
weiss-ben
1645cf281f feat: add new Median Search implementation (#1992)
* feat: add new median search algorithm with linked list

* Removed filename

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

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* fix: Requested changes made

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* Added algorithm and implementation explanations. Also added wikipedia link.

* Update search/median_search2.cpp

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

* Added @brief and wikipedia link to algo

* Update search/median_search2.cpp

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

* moved includes to top of file

* fix: clang-tidy fixes applied

* fix: clang-tidy fixes

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for b24ca86e

* Update search/median_search2.cpp

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

* clang-format and clang-tidy fixes for 247e0616

* fix: fixed test case failing

* clang-format and clang-tidy fixes for 4c1400db

* fix: test cases now pass

* clang-format and clang-tidy fixes for f3027971

* Update search/median_search2.cpp

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

* Update search/median_search2.cpp

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

* clang-format and clang-tidy fixes for b8b5f5fd

* clang-format and clang-tidy fixes for d67d450c

Co-authored-by: David Leal <halfpacho@gmail.com>
2022-09-26 11:28:55 -05:00
Shrutika Kailas Hilale
0febbf0314 chore: improve search/linear_search.cpp message (#1998)
* Update linear_search.cpp

Improved code: array size (input) entered by user

* Update search/linear_search.cpp

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

* fix: apply suggestions from code review

Co-authored-by: David Leal <halfpacho@gmail.com>
2022-09-26 09:35:38 -05:00