diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index cf6212b30c..50a15fc5cd 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -29,7 +29,7 @@ jobs: - name: Update DIRECTORY.md run: | wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/build_directory_md.py - python3 build_directory_md.py C . .c,.h > DIRECTORY.md + python3 build_directory_md.py C . .c,.h leetcode/ > DIRECTORY.md git commit -m "updating DIRECTORY.md" DIRECTORY.md || true - name: Get file changes run: | diff --git a/.github/workflows/leetcode_directory_writer.yml b/.github/workflows/leetcode_directory_writer.yml index 16cb656b98..d2657333e6 100644 --- a/.github/workflows/leetcode_directory_writer.yml +++ b/.github/workflows/leetcode_directory_writer.yml @@ -18,13 +18,22 @@ jobs: - name: Add python dependencies run: | pip install requests - - name: Write leectode DIRECTORY.md + - name: Write LeetCode DIRECTORY.md run: | python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md - git config --global user.name github-actions[bot] - git config --global user.email 'github-actions@users.noreply.github.com' - - name: Update LeetCode's directory + git pull || true + - name: Commit and push changes + uses: stefanzweifel/git-auto-commit-action@v4 + id: commit-push + with: + commit_message: "docs: updating `leetcode/DIRECTORY.md`" + branch: "leetcode-directory-${{ github.sha }}" + create_branch: true + - name: Creating and merging the PR + shell: bash + if: steps.commit-push.outputs.changes_detected == 'true' run: | - git add leetcode/DIRECTORY.md - git commit -am "updating DIRECTORY.md" || true - git push origin HEAD:$GITHUB_REF || true + gh pr create --base ${GITHUB_REF##*/} --head leetcode-directory-${{ github.sha }} --title 'docs: updating `leetcode/DIRECTORY.md`' --body 'Updated LeetCode directory (see the diff. for changes).' + gh pr merge --admin --merge --subject 'docs: updating `leetcode/DIRECTORY.md' --delete-branch + env: + GH_TOKEN: ${{ github.token }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 80a80b0f39..eb925dc92a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ add_subdirectory(machine_learning) add_subdirectory(process_scheduling_algorithms) add_subdirectory(numerical_methods) add_subdirectory(math) +add_subdirectory(cipher) ## Configure Doxygen documentation system cmake_policy(SET CMP0054 NEW) diff --git a/DIRECTORY.md b/DIRECTORY.md index 9a51282a02..1e49c05293 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -2,6 +2,9 @@ ## Audio * [Alaw](https://github.com/TheAlgorithms/C/blob/HEAD/audio/alaw.c) +## Cipher + * [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/cipher/rot13.c) + ## Client Server * [Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/client.c) * [Remote Command Exec Udp Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_client.c) @@ -167,158 +170,6 @@ * [Hash Sdbm](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_sdbm.c) * [Hash Xor8](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_xor8.c) -## Leetcode - * Src - * [1](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1.c) - * [10](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/10.c) - * [1008](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1008.c) - * [1009](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1009.c) - * [101](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/101.c) - * [1019](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1019.c) - * [1026](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1026.c) - * [104](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/104.c) - * [108](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/108.c) - * [1089](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1089.c) - * [109](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/109.c) - * [11](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/11.c) - * [110](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/110.c) - * [112](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/112.c) - * [1137](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1137.c) - * [1147](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1147.c) - * [118](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/118.c) - * [1184](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1184.c) - * [1189](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1189.c) - * [119](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/119.c) - * [12](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/12.c) - * [1207](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1207.c) - * [121](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/121.c) - * [124](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/124.c) - * [125](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/125.c) - * [1283](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1283.c) - * [13](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/13.c) - * [136](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/136.c) - * [14](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/14.c) - * [141](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/141.c) - * [142](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/142.c) - * [1524](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1524.c) - * [153](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/153.c) - * [16](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/16.c) - * [160](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/160.c) - * [1653](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1653.c) - * [1657](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1657.c) - * [169](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/169.c) - * [1695](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1695.c) - * [17](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/17.c) - * [1704](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1704.c) - * [173](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/173.c) - * [1752](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1752.c) - * [1769](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1769.c) - * [1833](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1833.c) - * [1838](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/1838.c) - * [189](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/189.c) - * [19](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/19.c) - * [190](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/190.c) - * [191](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/191.c) - * [2](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2.c) - * [20](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/20.c) - * [201](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/201.c) - * [2024](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2024.c) - * [203](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/203.c) - * [206](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/206.c) - * [2095](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2095.c) - * [21](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/21.c) - * [2125](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2125.c) - * [2130](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2130.c) - * [215](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/215.c) - * [217](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/217.c) - * [2222](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2222.c) - * [223](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/223.c) - * [2256](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2256.c) - * [226](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/226.c) - * [2270](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2270.c) - * [2279](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2279.c) - * [230](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/230.c) - * [2304](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2304.c) - * [231](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/231.c) - * [234](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/234.c) - * [236](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/236.c) - * [24](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/24.c) - * [242](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/242.c) - * [2482](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2482.c) - * [2501](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/2501.c) - * [26](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/26.c) - * [268](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/268.c) - * [27](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/27.c) - * [274](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/274.c) - * [278](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/278.c) - * [28](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/28.c) - * [283](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/283.c) - * [287](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/287.c) - * [29](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/29.c) - * [3](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/3.c) - * [32](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/32.c) - * [344](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/344.c) - * [35](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/35.c) - * [367](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/367.c) - * [37](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/37.c) - * [38](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/38.c) - * [387](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/387.c) - * [389](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/389.c) - * [4](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/4.c) - * [404](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/404.c) - * [42](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/42.c) - * [442](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/442.c) - * [45](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/45.c) - * [461](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/461.c) - * [476](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/476.c) - * [485](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/485.c) - * [5](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/5.c) - * [50](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/50.c) - * [509](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/509.c) - * [520](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/520.c) - * [53](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/53.c) - * [540](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/540.c) - * [561](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/561.c) - * [567](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/567.c) - * [6](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/6.c) - * [617](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/617.c) - * [62](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/62.c) - * [63](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/63.c) - * [647](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/647.c) - * [66](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/66.c) - * [669](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/669.c) - * [674](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/674.c) - * [684](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/684.c) - * [7](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/7.c) - * [700](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/700.c) - * [701](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/701.c) - * [704](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/704.c) - * [709](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/709.c) - * [75](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/75.c) - * [771](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/771.c) - * [79](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/79.c) - * [8](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/8.c) - * [807](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/807.c) - * [82](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/82.c) - * [83](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/83.c) - * [841](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/841.c) - * [852](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/852.c) - * [876](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/876.c) - * [9](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/9.c) - * [901](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/901.c) - * [905](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/905.c) - * [917](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/917.c) - * [931](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/931.c) - * [938](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/938.c) - * [94](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/94.c) - * [953](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/953.c) - * [965](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/965.c) - * [977](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/977.c) - * [979](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/979.c) - * [98](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/98.c) - * [985](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/985.c) - * [997](https://github.com/TheAlgorithms/C/blob/HEAD/leetcode/src/997.c) - ## Machine Learning * [Adaline Learning](https://github.com/TheAlgorithms/C/blob/HEAD/machine_learning/adaline_learning.c) * [K Means Clustering](https://github.com/TheAlgorithms/C/blob/HEAD/machine_learning/k_means_clustering.c) @@ -359,7 +210,6 @@ * [Poly Add](https://github.com/TheAlgorithms/C/blob/HEAD/misc/poly_add.c) * [Postfix Evaluation](https://github.com/TheAlgorithms/C/blob/HEAD/misc/postfix_evaluation.c) * [Quartile](https://github.com/TheAlgorithms/C/blob/HEAD/misc/quartile.c) - * [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/misc/rot13.c) * [Rselect](https://github.com/TheAlgorithms/C/blob/HEAD/misc/rselect.c) * [Run Length Encoding](https://github.com/TheAlgorithms/C/blob/HEAD/misc/run_length_encoding.c) * [Shunting Yard](https://github.com/TheAlgorithms/C/blob/HEAD/misc/shunting_yard.c) diff --git a/LICENSE b/LICENSE index ecc818272d..1e132df443 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2016-2022 TheAlgorithms and contributors +Copyright (C) 2016-2023 TheAlgorithms and contributors GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/cipher/CMakeLists.txt b/cipher/CMakeLists.txt new file mode 100644 index 0000000000..c1d93bbc91 --- /dev/null +++ b/cipher/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. The RELATIVE flag makes it easier to extract an executable's name +# automatically. + +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c ) +foreach( testsourcefile ${APP_SOURCES} ) + string( REPLACE ".c" "" testname ${testsourcefile} ) # File type. Example: `.c` + add_executable( ${testname} ${testsourcefile} ) + + if(OpenMP_C_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_C) + endif() + if(MATH_LIBRARY) + target_link_libraries(${testname} ${MATH_LIBRARY}) + endif() + install(TARGETS ${testname} DESTINATION "bin/cipher") # Folder name. Do NOT include `<>` + +endforeach( testsourcefile ${APP_SOURCES} ) diff --git a/misc/rot13.c b/cipher/rot13.c similarity index 100% rename from misc/rot13.c rename to cipher/rot13.c