Commit Graph

81 Commits

Author SHA1 Message Date
Rakshit Raj
1f5ca99571
feat: Add sorting/count_inversions.cpp (#1425)
* Create count_inversions.cpp

Counts the number of inversions in a list using merge sort. The number of Inversions in a list is the measure of the list's proximity to being sorted in ascending/increasing order.

* Update count_inversions.cpp

- fixed template error on line 156
- an added test case for character array
- an added test case for list type double

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for b51af5e8

* using `uint64_t` from cstdint header 

and doxygen formatiing

* clang-format and clang-tidy fixes for 047578bb

* Update count_inversions.cpp

* added comments on imports

* clang-format and clang-tidy fixes for 2f65017d

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update count_inversions.cpp

* clang-format and clang-tidy fixes for 5d5cc53e

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update count_inversions.cpp

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update sorting/count_inversions.cpp

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

* Update count_inversions.cpp

* clang-format and clang-tidy fixes for 121ce330

* Update sorting/count_inversions.cpp

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-12-15 20:33:04 -06:00
Kaustubh Damania
67e26cfbae
feat: Add ncr mod p code (#1325)
* feat: Add ncr mod p code (#1323)

* Update math/ncr_modulo_p.cpp

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

* Added all functions inside a class + added more asserts

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for f6df24a5

* Replace int64_t to uint64_t + add namespace + detailed documentation

* clang-format and clang-tidy fixes for e09a0579

* Add extra namespace + add const& in function arguments

* clang-format and clang-tidy fixes for 8111f881

* Update ncr_modulo_p.cpp

* clang-format and clang-tidy fixes for 2ad2f721

* Update math/ncr_modulo_p.cpp

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

* Update math/ncr_modulo_p.cpp

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

* Update math/ncr_modulo_p.cpp

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

* clang-format and clang-tidy fixes for 5b69ba5c

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for a8401d4b

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-22 23:05:01 +05:30
Suyash Jaiswal
5bd438066c
feat: Add sorting/radix_sort2.cpp (#1268)
* radix_sort2.cpp

* Performed changes in radix_sort2.cpp

* Update sorting/radix_sort2.cpp

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

* Update sorting/radix_sort2.cpp

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

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for e01027fa

* update radix_sort2.cpp

* Update sorting/radix_sort2.cpp

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

* Update sorting/radix_sort2.cpp

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

* Update sorting/radix_sort2.cpp

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

* Update sorting/radix_sort2.cpp

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

* update radix_sort2.cpp

* update radix_sort2.cpp

* update radix_sort2.cpp

* update radix_sort2.cpp

* update radix_sort2.cpp

* update radix_sort2.cpp

* update radix_sort2.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-02 14:40:53 -06:00
Roshan Kanwar
e44943aadb
feat: add wiggle sort algorithm (#1265)
* create wiggle_sort.cpp

* used array instead of vector

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* updating DIRECTORY.md

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* removed swap function and used std::swap

* update wiggle_sort.cpp

* update wiggle_sort.cpp

* Update wiggle_sort.cpp

* Update wiggle_sort.cpp

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-28 22:51:49 +05:30
Tsung-Han Ho
b1079da17d
feat: add cycle sort algorithm (#1252)
* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* feat: add cycle sort algorithm

* updating DIRECTORY.md

* Add namespace decription

* fix: add assert and template

* fix: add some comment

* fix: update some suggested changes

* fix: update some suggested changes

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-21 11:07:53 -04:00
David Leal
2c13a7a376
[fix/docs]: Improve backtracking/n_queens_all_solution_optimised.cpp (#1041)
* updating DIRECTORY.md

* [fix/docs]: Improve backtracking/n_queens_...

...all_solution_optimised.cpp

* fix: Remove function-like macros

* clang-format and clang-tidy fixes for 689b788c

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-19 14:59:20 -05:00
divyansh12323
5731bcd6fc
feat: Add Pancake Sort algorithm (#1189)
* Create pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* Update pancake_sort.cpp

* updating DIRECTORY.md

* Update pancake_sort.cpp

* Update pancake_sort.cpp

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-16 15:06:21 -05:00
Mertcan Davulcu
8e14b25fa3
Added strand sort algorithm (#1081)
* Create strand_sort.cpp

* Update strand_sort.cpp

* Update strand_sort.cpp

* Delete strand_sort.cpp

* Create strand_sort.cpp

* Update sorting/strand_sort.cpp

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

* Update strand_sort.cpp

* Update strand_sort.cpp

* Update sorting/strand_sort.cpp

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

* Update sorting/strand_sort.cpp

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

* Update strand_sort.cpp

* Update sorting/strand_sort.cpp

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

* Update sorting/strand_sort.cpp

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

* Update sorting/strand_sort.cpp

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

* Update sorting/strand_sort.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>

* Update sorting/strand_sort.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>

* Update sorting/strand_sort.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>

* Update strand_sort.cpp

* Update strand_sort.cpp

* updating DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-30 12:21:25 -05:00
@8848hg
67be3a592d
fix: short a bit the code (sorting/merge_sort.cpp) (#1066)
* Merge_sort modified in while loop

* Merge_sort modified in while loop

* Merge_sort modified in while loop

* Update merge_sort.cpp
2020-09-27 15:53:47 -05:00
Rakshit Raj
88fe6911df
Update merge_sort.cpp (#1077)
On line 133 --- corrected the size argument so that the last element is not missed
2020-09-09 12:51:07 -04:00
Krishna Vedala
08c4a3f664
feat: Added merge-insertion sort from #246 (#1062)
* Create Merge-insertion sort.cpp

* fixed file path

* working code

* added documentation

* replace c-style array with std::array

* updating DIRECTORY.md

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

Co-authored-by: sinkyoungdeok <tlsrudejr123@nate.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-03 08:51:30 -04:00
Lownish Rai Sookha
66dcc4c394
feat: add Pigeonhole algorithm (#1028)
* feat: add Pigeonhole algorithm

* Executed clang-format

* Used pointers and vector

* Corrected clang-tidy issues

* Modified code structure

* Apply suggestions from code review

Suggested changes applied

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

* Added missing parameter and documentation

* Added delete function

* Update pigeonhole_sort.cpp

* Corrected delete function

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

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Changed documentation regarding array size

* clang-tidy

* Apply suggestions from code review

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

* assert moved to test function

* Update pigeonhole_sort.cpp

* Update sorting/pigeonhole_sort.cpp

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

* Added test function and inbuilt min function

* min and max to const variables

* const int* to auto

* const int* to auto

* Apply suggestions from code review

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>

* Modified pigeonSort documentation

* Corrected test functions

Co-authored-by: lsurface <lownish@hotmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
2020-08-25 18:57:24 -05:00
Krishna Vedala
8d68e61edf
[feature] new implementation of Quick sort (#958)
* added quick_sort_3

* Corrected some formatting error

* made more C-plus-plusy

* add test cases

* updating DIRECTORY.md

* clang-tidy fixes for 30c9a199ad

* better selef-tests + use std::vector

* use size_t

* change size_t to int32_t

Co-authored-by: mohit <rj7555555@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-20 21:12:31 -04:00
Deep Raval
ef1bf8849e
Fixed an issue related to doc (doxygen) (#960) 2020-07-19 14:42:01 -04:00
Krishna Vedala
67ec2aa982
[feature] Gnome sort (#956)
* implement gnome sort algorithm

* change name as in contribute.md

* remove std and fixed style  on clang-format

* Delete GnomeSort.cpp

* style changes

* add documentation

* T template

* style changes

* style changes

* repeated error fix

* cout fixed

* fix gnome_sort

* add assertions'

* added random values test

* updating DIRECTORY.md

* clang-tidy fixes for 97161cf894

* fix initial index value

* add braces to one line for-loops

* fix function documentation

Co-authored-by: beqakd <bgoga16@freeuni.edu.ge>
Co-authored-by: beqakd <39763019+beqakd@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-18 17:16:45 -04:00
Deep Raval
cac5fbe4aa
feat: add Bogo Sort (#952)
* Added Bogo Sort

* Changed code according to guidelines

* Added Comments and example

* Improved code quality

* Added range based loop and included cassert

* Changed Vectors to Array

* Added const to vector arg and now returning sorted array

* Changed vector to array and changed description format

* Added namespace sorting, Function description and tests

* Update sorting/Bogo_Sort.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>

* Replaced Shuffle with std::random_shuffle

* Renamed filename to smallercase, Added shuffle for ref and updated bracket styling

* Added missing ')'

* updating DIRECTORY.md

* Added spaces in single line comments

* Added Spaces

* Update sorting/bogo_sort.cpp

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

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2020-07-17 18:27:40 -04:00
Krishna Vedala
390ee8428e
fix to upper case 2020-07-01 13:08:41 -04:00
Krishna Vedala
4045bcddf3
verb correction 2020-07-01 13:05:52 -04:00
Krishna Vedala
84fd1cb0d0
small case 'e'
Co-authored-by: Ayaan Khan <ayaankhan98@gmail.com>
2020-07-01 13:04:54 -04:00
Krishna Vedala
fed7dd1c13
improved self-tests 2020-07-01 12:37:54 -04:00
Krishna Vedala
69b5c8395a
better rendering of example steps 2020-07-01 10:36:08 -04:00
Krishna Vedala
9b799c93cb
added documentation for new function 2020-07-01 10:19:18 -04:00
Krishna Vedala
957b57cf60
fix issues from #929 2020-07-01 10:10:51 -04:00
github-actions
e4c62d28fe formatting source-code for 7af31e32a2 2020-07-01 10:10:51 +00:00
Ayaan Khan
7af31e32a2 Fix for loop formatiing 2020-07-01 15:39:53 +05:30
Ayaan Khan
dd0a07f18a loop formating fix 2020-07-01 15:38:55 +05:30
github-actions
3e1edca024 formatting source-code for efcccd0148 2020-06-30 22:35:45 +00:00
Ayaan Khan
efcccd0148 resolved merge conflict 2020-07-01 04:04:49 +05:30
Ayaan Khan
8179fbfdec test cases added 2020-07-01 04:03:13 +05:30
github-actions
d64f17f94c formatting source-code for 9217b4d8a8 2020-06-30 22:26:08 +00:00
Ayaan Khan
9217b4d8a8 Merge branch 'master' of https://github.com/ayaankhan98/C-Plus-Plus 2020-07-01 03:54:33 +05:30
Ayaan Khan
d3324aaf34 Fix: code quality and Docs 2020-07-01 03:54:01 +05:30
Ayaan Khan
3fc85322c1
Merge pull request #899 from ayaankhan98/master
fix: minor docs issue
2020-06-25 04:13:29 +05:30
Ayaan Khan
f1ab19bb33 fix: minor docs issue 2020-06-25 03:39:12 +05:30
Krishna Vedala
d958eec03b
Merge pull request #888 from ayaankhan98/master
fix: LGTM code quality and Added docs
2020-06-23 17:02:57 -04:00
Panquesito7
0767af4a0d
fix: Revert comb_sort changes 2020-06-23 15:26:55 -05:00
github-actions
48a163e51a formatting source-code for 3a7a266ada 2020-06-23 20:22:30 +00:00
Ayaan Khan
92d2bf012a Added tests for comb_sort.cpp 2020-06-24 01:49:33 +05:30
Panquesito7
0356a9cdf3
fix: Various LGTM fixes 2020-06-23 15:13:28 -05:00
Ayaan Khan
2d0325699f fixed code quality and added docs 2020-06-24 01:30:14 +05:30
Ayaan Khan
7f40775055 fix docs 2020-06-24 00:36:56 +05:30
Ayaan Khan
f0ab9a0d38 fixed line spacing in tests 2020-06-24 00:36:56 +05:30
github-actions
a56e54ca15 formatting source-code for 7c8617fa46 2020-06-24 00:36:56 +05:30
Ayaan Khan
555f4fb98f fixed docs 2020-06-24 00:36:56 +05:30
github-actions
6d88c992ed formatting source-code for ced5dcd6c4 2020-06-24 00:36:56 +05:30
Ayaan Khan
2a41d916b0 Added template and test cases 2020-06-24 00:36:56 +05:30
Ayaan Khan
86bd671c66 switched to normal functions from lambda 2020-06-24 00:36:56 +05:30
github-actions
11728ee231 formatting source-code for e464ddac36 2020-06-24 00:36:22 +05:30
Ayaan Khan
38db7fdec0 Bug Fix heap sort [Fresh Implementation] 2020-06-24 00:35:41 +05:30
github-actions
549daeebfd formatting source-code for 8233eda889 2020-06-24 00:35:41 +05:30