Commit Graph

21 Commits

Author SHA1 Message Date
Nitin Sharma
446e0a5ce8
feat: add lru caching algorithm (#1557)
* updating DIRECTORY.md

* feat: add lru caching algorithm

* removing clang tidy warnings

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for fcb50fb7

* docs updated

* clang-format and clang-tidy fixes for ee18e3aa

* using list instead of bits/stdc++.h

* clang-format and clang-tidy fixes for 19d09e85

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

* Update others/lru_cache.cpp

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

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

* using uint for non negative numbers

* clang-format and clang-tidy fixes for 87e7df55

* Update others/lru_cache.cpp

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

* clang-format and clang-tidy fixes for b423fd4b

* suggestions applied

* clang-format and clang-tidy fixes for e3ba29eb

* Update others/lru_cache.cpp

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

* clang-format and clang-tidy fixes for bdeee3da

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
2021-08-17 12:25:08 -05:00
Swastika Gupta
f34f93e77a
feat: Add the Subarray Sum implementation (#1527)
* Create subarray_sum.cpp

* updating DIRECTORY.md

* clang-format and clang-tidy fixes for 0a293ece

* Update backtracking/subarray_sum.cpp

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

* clang-format and clang-tidy fixes for f37f7b7c

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* Update subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* clang-format and clang-tidy fixes for 047366a8

* Update subarray_sum.cpp

* clang-format and clang-tidy fixes for 512b1887

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* Update backtracking/subarray_sum.cpp

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

* fix: Apply suggestions from code review

* docs: Apply suggestions from code review

* clang-format and clang-tidy fixes for e6979047

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2021-07-21 14:22:16 -05:00
Motasim
47c84137ee
feat: Added implementation of iterative version of tree traversals. (#1506)
* feat: Added iterative version of tree traversals.

Here is the implementation of the iterative version of the Preorder, Postorder, and the Inorder traversal of given tree.
.
Time Complexity: O(n), where 'n' is the total number of nodes in a tree.

* updating DIRECTORY.md

* fixed: function descriptions, namespace declaration, and included separate libraries.

* fixed: added range bases for loops.

* style: proper indentation

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

* style: proper indentation

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

* style: proper indentation

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

* fix: C style NULL to nullptr

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

* docs: spell correction

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

* style: formatted comments.

* fixes: static_cast, if and for statement braces

* style: modified pointer declaration.

* fixes: removed use of typedef, renamed BT to Node

* Fix `clang-tidy` warnings

* fix: Try to fix `clang-tidy` warnings this time

* docs: Proper function description

Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>

* fix: Class based approach

* docs: Proper formatted comment

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

* docs: Proper indentation

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

* fix: Initialized data variable

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

* docs: Proper formatted comment

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

* docs: Proper indentation

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

* docs: Proper formatted comment

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

* docs: Proper function description

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

* docs: Removed unnecessary comment

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

* docs: Proper formatted comment

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

* docs: Proper function description

* docs: Proper variables description

Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>

* docs: Included variables description

Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>

* docs: Included variables description

Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>

* docs: Proper variables description

Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>

* fixes: Self-test implementation and namespace

* docs: Documentation improvements

* docs: Proper formatted description

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

* docs: Proper formatted description

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

* docs: Proper formatted description

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

* docs: Proper formatted description

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

* docs: Proper indentation

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

* docs: Proper formatted description

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

* docs: Improved function description

* docs: Proper formatted description

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

* test: Added test cases for negative values

* docs: Proper description

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

* docs: Proper formatted comment

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

* docs: Proper formatted comment

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

* docs: Proper function description

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

* docs: Proper formatted description

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

* docs: Proper description

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

* docs: Proper description

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Mann Patel <46739555+manncodes@users.noreply.github.com>
2021-07-05 19:32:41 -05:00
Darshana Sarma
bcf79e259a
feat: Added Postfix Evaluation (#1083)
* feat:Added Postfix evaluation

* updating DIRECTORY.md

* Fixed global variable name and stack def

* Fixed c from int to float

* Fixed clang-tidy

* Modified code for larger values

* Added string header

* Suggested changes

* Fixed clang-tidy

* Apply suggestions from code review

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

* Added description for class

* Fixed function calling

* Apply suggestions from code review

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

* Updated evaluate function documentation

* Apply suggestions from code review

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

* Update others/postfix_evaluation.cpp

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

* Update others/postfix_evaluation.cpp

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>
Co-authored-by: Darshana-Sarma <lownish@hotmail.com>
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
2020-09-30 13:48:39 -05:00
Anushka Verma
039022becf fix typo: (rename file) fast_interger_input -> fast_integer_input 2020-08-24 01:19:39 +05:30
github-actions
ef5f330834 formatting source-code for a190674131 2020-06-24 22:28:10 +00:00
Krishna Vedala
a190674131
fix errors in matrix_exponentiation 2020-06-24 18:27:01 -04:00
Panquesito7
b6fdaa63eb
docs: Change variable names 2020-06-23 18:45:56 -05:00
Panquesito7
48b7773b37
fix: Various LGTM fixes 2020-06-23 16:34:53 -05:00
Krishna Vedala
aaa08b0150
Major rework to improve code quality and add automation checks (#805)
* delete secant method - it is identical to regula falsi

* document + improvize root finding algorithms

* attempt to document gaussian elimination

* added file brief

* commented doxygen-mainpage, added files-list link

* corrected files list link path

* files-list link correction - this time works :)

* document successive approximations

* cleaner equation

* updating DIRECTORY.md

* documented kmp string search

* document brute force string search

* document rabin-karp string search

* fixed mainpage readme

* doxygen v1.8.18 will suppress out the #minipage in the markdown

* cpplint correction for header guard style

* github action to auto format source code per cpplint standard

* updated setting to add 1 space before `private` and `public` keywords

* auto rename files and auto format code

* added missing "run" for step

* corrected asignmemt operation

* fixed trim and assign syntax

* added git move for renaming bad filenames

* added missing pipe for trim

* added missing space

* use old and new fnames

* store old fname using echo

* move files only if there is a change in filename

* put old filenames in quotes

* use double quote for old filename

* escape double quotes

* remove old_fname

* try escape characters and echo"

* add file-type to find

* cleanup echo

* ensure all trim variables are also in quotes

* try escape -quote again

* remove second escpe quote

* use single quote for first check

* use carets instead of quotes

* put variables in brackets

* remove -e from echo

* add debug echos

* try print0 flag

* find command with while instead of for-loop

* find command using IFS instead

* 🎉 IFS fix worked - escaped quotes for git mv

* protetc each word in git mv ..

* filename exists in lower cases - renamed

* 🎉 git push enabled

* updating DIRECTORY.md

* git pull & then push

* formatting filenames d7af6fdc8c

* formatting source-code for d7af6fdc8c

* remove allman break before braces

* updating DIRECTORY.md

* added missing comma lost in previous commit

* orchestrate all workflows

* fix yml indentation

* force push format changes, add title to DIRECTORY.md

* pull before proceeding

* reorganize pull commands

* use master branches for actions

* rename .cc files to .cpp

* added class destructor to clean up dynamic memory allocation

* rename to awesome workflow

* commented whole repo cpplint - added modified files lint check

* removed need for cpplint

* attempt to use actions/checkout@master

* temporary: no dependency on cpplint

* formatting filenames 153fb7b8a5

* formatting source-code for 153fb7b8a5

* updating DIRECTORY.md

* fix diff filename

* added comments to the code

* added test case

* formatting source-code for a850308fba

* updating DIRECTORY.md

* added machine learning folder

* added adaline algorithm

* updating DIRECTORY.md

* fixed issue [LWG2192](https://cplusplus.github.io/LWG/issue2192) for std::abs on MacOS

* add cmath for same bug: [LWG2192](https://cplusplus.github.io/LWG/issue2192) for std::abs on MacOS

* formatting source-code for f8925e4822

* use STL's inner_product

* formatting source-code for f94a330594

* added range comments

* define activation function

* use equal initial weights

* change test2 function to predict

* activation function not friend

* previous commit correction

* added option for predict function to return value before applying activation function as optional argument

* added test case to classify points lying within a sphere

* improve documentation for adaline

* formatting source-code for 15ec4c3aba

* added cmake to geometry folder

* added algorithm include for std::max

* add namespace - machine_learning

* add namespace - statistics

* add namespace - sorting

* added sorting algos to namespace sorting

* added namespace string_search

* formatting source-code for fd69530515

* added documentation to string_search namespace

* feat: Add BFS and DFS algorithms to check for cycle in a directed graph

* Remove const references for input of simple types

Reason: overhead on access

* fix bad code

sorry for force push

* Use pointer instead of the non-const reference

because apparently google says so.

* Remove a useless and possibly bad Graph constuctor overload

* Explicitely specify type of vector during graph instantiation

* updating DIRECTORY.md

* find openMP before adding subdirectories

* added kohonen self organizing map

* updating DIRECTORY.md

* remove older files and folders from gh-pages before adding new files

* remove chronos library due to inacceptability by cpplint

* use c++ specific static_cast instead

* initialize radom number generator

* updated image links with those from CPP repository

* rename computer.... folder to numerical methods

* added durand kerner method for root computation for arbitrarily large polynomials

* fixed additional comma

* fix cpplint errors

* updating DIRECTORY.md

* convert to function module

* update documentation

* move openmp to main loop

* added two test cases

* use INT16_MAX

* remove return statement from omp-for loop and use "break"

* run tests when no input is provided and skip tests when input polynomial is provided

* while loop cannot have break - replaced with continue and check is present in the main while condition

* (1) break while loop (2) skip runs on break_loop instead of hard-break

* add documentation images

* use long double for errors and tolerance checks

* make iterator variable i local to threads

* add critical secions to omp threads

* bugfix: move file writing outside of the parallel loop
othersie, there is no gurantee of the order of roots written to file

* rename folder to data_structures

* updating DIRECTORY.md

* fix ambiguous symbol `size`

* add data_structures to cmake

* docs: enable tree view, add timestamp in footer, try clang assistaed parsing

* doxygen - open links in external window

* remove invalid parameter from function docs

* use HTML5 img tag to resize images

* move file to proper folder

* fix documentations and cpplint

* formatting source-code for aacaf9828c

* updating DIRECTORY.md

* cpplint: add braces for multiple statement if

* add explicit link to badges

* remove  duplicate line

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

* remove namespace indentation

* remove file associations in settings

* add author name

* enable cmake in subfolders of data_structures

* create and link object file

* cpp lint fixes and instantiate template classes

* cpp lint fixes and instantiate template classes

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

* cpplint - ignore `build/include`

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

* disable redundant gcc compilation in cpplint workflow

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

* template header files contain function codes as well and removed redundant subfolders

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

* updating DIRECTORY.md

* remove semicolons after functions in a class

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

* cpplint header guard style

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

* remove semilon

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

* added LU decomposition algorithm

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

* added QR decomposition algorithm

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

* use QR decomposition to find eigen values

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

* updating DIRECTORY.md

* use std::rand for thread safety

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

* move srand to main()

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

* cpplint braces correction

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

* updated eigen value documentation

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

* fix matrix shift doc

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

* rename CONTRIBUTION.md to CONTRIBUTING.md #836

* remove 'sort alphabetical order' check

* added documentation check

* remove extra paranthesis

* added gitpod

* added gitpod link from README

* attempt to add vscode gitpod extensions

* update gitpod extensions

* add gitpod extensions cmake-tools and git-graph

* remove gitpod init and add commands

* use init to one time install doxygen, graphviz, cpplint

* use gitpod dockerfile

* add ninja build system to docker

* remove configure task

* add github prebuild specs to gitpod

* disable gitpod addcommit

* update documentation for kohonen_som

* added ode solve using forward euler method

* added mid-point euler ode solver

* fixed itegration step equation

* added semi-implicit euler ODE solver

* updating DIRECTORY.md

* fix cpplint issues - lines 117 and 124

* added documentation to ode group

* corrected semi-implicit euler function

* updated docs and test cases better structure

* replace `free` with `delete` operator

* formatting source-code for f55ab50cf2

* updating DIRECTORY.md

* main function must return

* added machine learning group

* added kohonen som topology algorithm

* fix graph image path

* updating DIRECTORY.md

* fix braces

* use snprintf instead of sprintf

* use static_cast

* hardcode character buffer size

* fix machine learning groups in documentation

* fix missing namespace function

* replace kvedala fork references to TheAlgorithms

* fix bug in counting_sort

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Anmol3299 <mittalanmol22@gmail.com>
2020-06-19 21:34:56 +05:30
Christian Clauss
039ca7bdea
Update others/stairs_pattern.cpp 2020-04-19 17:48:48 +02:00
faizan Ahamed
c2316e1efc
Update stairs_pattern.cpp 2020-04-19 20:50:42 +05:30
faizan Ahamed
9ac7981fed
Update stairs_pattern.cpp 2020-04-19 20:39:06 +05:30
faizan Ahamed
2b01decae1
Update stairs_pattern.cpp 2020-04-19 20:24:28 +05:30
faizan Ahamed
e15dd6ec99
Update stairs_pattern.cpp 2020-04-19 20:23:48 +05:30
faizan Ahamed
e4fa1dbcaf
Create stairs_pattern.cpp 2020-04-19 18:49:08 +05:30
stepfencurryxiao
f659bcc9fc Don't use bits/stdc++.h 2020-04-18 10:43:43 +08:00
Siddharth M
ca068e5828
Measure time (#706)
* Create measure_time_elapsed.cpp

* add functionality to measure time elapsed of a code

* cout --> std:cout

* Update measure_time_elapsed.cpp

* Update time_elapsed.cpp

* Update measure_time_elapsed.cpp

* std:cout << getTimeInMicroseconds() - starttime;

* std:cout << getTimeInMicroseconds() - starttime;

* Update measure_time_elapsed.cpp

* Fix include order and use int64

* Remove trailing whitespace

* Delete time_elapsed.cpp

* int64_t

* #include <sys/time.h>

* long long

* int64

* int64_t

* __int64_t

* std::cout and std::nullptr

* #include <iostream>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-01 15:47:32 +01:00
Nishant Sharma
513a7d3a77 added fast_integer_input.cpp (#696)
* added fast_integer_input.cpp

* fixed white spaces

* fixed white spaces

* fixed std::

* fixed std::

* \n

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-10 19:56:12 +01:00
Kushagra Nigam
b53bdf16ec Matrix Exponentiation (#589)
* Matrix Exponentiation

* Update and rename Others/Matrix_Expo.cpp to others/matrix_exponentiation.cpp

* Update matrix_exponentiation.cpp

* clang-format -i -style="{BasedOnStyle: Google, IndentWidth: 4}" matrix_exponentiation.cpp

* clang-format -i -style="{IndentWidth: 4}" matrix_exponentiation.cpp

* Fix cpplint readability/braces issue

* using std::cin; using std::cout; using std::vector;

* added int_64 instead of long long

* Minor changes

* Update matrix_exponentiation.cpp
2019-12-05 22:13:16 +01:00
Christian Clauss
ac1ba3a613
rename Others -> others (#648)
* rename Others -> temp

* rename Others -> others
2019-11-28 13:29:54 +01:00