Showing preview only (5,035K chars total). Download the full file or copy to clipboard to get everything.
Repository: TheAlgorithms/C
Branch: master
Commit: e5dad3fa8def
Files: 497
Total size: 4.7 MB
Directory structure:
gitextract_1eckva4m/
├── .clang-format
├── .clang-tidy
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── feature_request.yml
│ │ └── other.yml
│ ├── labeler.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── approved-label.yml
│ ├── awesome_workflow.yml
│ ├── codeql.yml
│ ├── directory_writer.yml
│ ├── gh-pages.yml
│ ├── labeler.yml
│ ├── leetcode_directory_writer.yml
│ └── stale.yml
├── .gitignore
├── .gitpod.dockerfile
├── .gitpod.yml
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CodingGuidelines.md
├── DIRECTORY.md
├── Doxyfile
├── LICENSE
├── README.md
├── REVIEWER_CODE.md
├── audio/
│ ├── CMakeLists.txt
│ └── alaw.c
├── cipher/
│ ├── CMakeLists.txt
│ ├── affine.c
│ └── rot13.c
├── client_server/
│ ├── CMakeLists.txt
│ ├── bool.h
│ ├── client.c
│ ├── fork.h
│ ├── remote_command_exec_udp_client.c
│ ├── remote_command_exec_udp_server.c
│ ├── server.c
│ ├── tcp_full_duplex_client.c
│ ├── tcp_full_duplex_server.c
│ ├── tcp_half_duplex_client.c
│ ├── tcp_half_duplex_server.c
│ ├── udp_client.c
│ └── udp_server.c
├── conversions/
│ ├── CMakeLists.txt
│ ├── binary_to_decimal.c
│ ├── binary_to_hexadecimal.c
│ ├── binary_to_octal.c
│ ├── c_atoi_str_to_integer.c
│ ├── celsius_to_fahrenheit.c
│ ├── decimal_to_any_base.c
│ ├── decimal_to_binary.c
│ ├── decimal_to_binary_recursion.c
│ ├── decimal_to_hexa.c
│ ├── decimal_to_octal.c
│ ├── decimal_to_octal_recursion.c
│ ├── hexadecimal_to_octal.c
│ ├── hexadecimal_to_octal2.c
│ ├── infix_to_postfix.c
│ ├── infix_to_postfix2.c
│ ├── int_to_string.c
│ ├── octal_to_binary.c
│ ├── octal_to_decimal.c
│ ├── octal_to_hexadecimal.c
│ ├── roman_numerals_to_decimal.c
│ └── to_decimal.c
├── data_structures/
│ ├── array/
│ │ ├── README.md
│ │ ├── carray.c
│ │ ├── carray.h
│ │ └── carray_tests.c
│ ├── binary_trees/
│ │ ├── avl_tree.c
│ │ ├── binary_search_tree.c
│ │ ├── create_node.c
│ │ ├── recursive_traversals.c
│ │ ├── red_black_tree.c
│ │ ├── segment_tree.c
│ │ ├── threaded_binary_trees.c
│ │ └── words_alphabetical.c
│ ├── dictionary/
│ │ ├── README.md
│ │ ├── dict.c
│ │ ├── dict.h
│ │ └── test_program.c
│ ├── dynamic_array/
│ │ ├── Makefile
│ │ ├── dynamic_array.c
│ │ ├── dynamic_array.h
│ │ └── main.c
│ ├── graphs/
│ │ ├── Makefile
│ │ ├── bellman_ford.c
│ │ ├── bfs.c
│ │ ├── bfs_queue.c
│ │ ├── dfs.c
│ │ ├── dfs_recursive.c
│ │ ├── dijkstra.c
│ │ ├── euler.c
│ │ ├── floyd_warshall.c
│ │ ├── graph.c
│ │ ├── graph.h
│ │ ├── hamiltonian.c
│ │ ├── kruskal.c
│ │ ├── queue.c
│ │ ├── queue.h
│ │ ├── strongly_connected_components.c
│ │ ├── topological_sort.c
│ │ └── transitive_closure.c
│ ├── hash_set/
│ │ ├── Makefile
│ │ ├── hash_set.c
│ │ ├── hash_set.h
│ │ └── main.c
│ ├── heap/
│ │ ├── max_heap.c
│ │ └── min_heap.c
│ ├── linked_list/
│ │ ├── ascending_priority_queue.c
│ │ ├── circular_doubly_linked_list.c
│ │ ├── circular_linked_list.c
│ │ ├── doubly_linked_list.c
│ │ ├── merge_linked_lists.c
│ │ ├── middle_element_in_list.c
│ │ ├── queue_linked_list.c
│ │ ├── singly_link_list_deletion.c
│ │ └── stack_using_linked_lists.c
│ ├── list/
│ │ ├── Makefile
│ │ ├── list.c
│ │ ├── list.h
│ │ └── main.c
│ ├── queue/
│ │ ├── include.h
│ │ └── queue.c
│ ├── stack/
│ │ ├── README.md
│ │ ├── dynamic_stack.c
│ │ ├── main.c
│ │ ├── parenthesis.c
│ │ ├── stack.c
│ │ ├── stack.h
│ │ └── stack_linked_list/
│ │ ├── Makefile
│ │ ├── main.c
│ │ ├── stack.c
│ │ └── stack.h
│ ├── stack.c
│ ├── trie/
│ │ ├── dictionary.txt
│ │ └── trie.c
│ └── vector.c
├── developer_tools/
│ ├── CMakeLists.txt
│ ├── malloc_dbg.c
│ ├── malloc_dbg.h
│ ├── min_printf.h
│ ├── test_malloc_dbg.c
│ └── test_min_printf.c
├── dynamic_programming/
│ ├── CMakeLists.txt
│ ├── lcs.c
│ └── matrix_chain_order.c
├── exercism/
│ ├── README.md
│ ├── acronym/
│ │ ├── acronym.c
│ │ └── acronym.h
│ ├── hello_world/
│ │ ├── hello_world.c
│ │ └── hello_world.h
│ ├── isogram/
│ │ ├── isogram.c
│ │ └── isogram.h
│ ├── rna_transcription/
│ │ ├── rna_transcription.c
│ │ └── rna_transcription.h
│ └── word_count/
│ ├── word_count.c
│ └── word_count.h
├── games/
│ ├── CMakeLists.txt
│ ├── hangman.c
│ ├── naval_battle.c
│ ├── tic_tac_toe.c
│ └── words.txt
├── geometry/
│ ├── CMakeLists.txt
│ ├── geometry_datatypes.h
│ ├── quaternions.c
│ └── vectors_3d.c
├── graphics/
│ ├── CMakeLists.txt
│ └── spirograph.c
├── greedy_approach/
│ ├── dijkstra.c
│ └── prim.c
├── hash/
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── hash_adler32.c
│ ├── hash_blake2b.c
│ ├── hash_crc32.c
│ ├── hash_djb2.c
│ ├── hash_sdbm.c
│ └── hash_xor8.c
├── leetcode/
│ ├── DIRECTORY.md
│ ├── README.md
│ └── src/
│ ├── 1.c
│ ├── 10.c
│ ├── 1008.c
│ ├── 1009.c
│ ├── 101.c
│ ├── 1019.c
│ ├── 1026.c
│ ├── 104.c
│ ├── 108.c
│ ├── 1089.c
│ ├── 109.c
│ ├── 11.c
│ ├── 110.c
│ ├── 112.c
│ ├── 1137.c
│ ├── 1147.c
│ ├── 118.c
│ ├── 1184.c
│ ├── 1189.c
│ ├── 119.c
│ ├── 12.c
│ ├── 1207.c
│ ├── 121.c
│ ├── 124.c
│ ├── 125.c
│ ├── 1283.c
│ ├── 13.c
│ ├── 136.c
│ ├── 14.c
│ ├── 141.c
│ ├── 142.c
│ ├── 1524.c
│ ├── 153.c
│ ├── 16.c
│ ├── 160.c
│ ├── 1653.c
│ ├── 1657.c
│ ├── 169.c
│ ├── 1695.c
│ ├── 17.c
│ ├── 1704.c
│ ├── 173.c
│ ├── 1752.c
│ ├── 1769.c
│ ├── 1833.c
│ ├── 1838.c
│ ├── 189.c
│ ├── 19.c
│ ├── 190.c
│ ├── 191.c
│ ├── 2.c
│ ├── 20.c
│ ├── 201.c
│ ├── 2024.c
│ ├── 203.c
│ ├── 206.c
│ ├── 2095.c
│ ├── 21.c
│ ├── 2125.c
│ ├── 2130.c
│ ├── 215.c
│ ├── 217.c
│ ├── 2222.c
│ ├── 223.c
│ ├── 2256.c
│ ├── 226.c
│ ├── 2270.c
│ ├── 2279.c
│ ├── 230.c
│ ├── 2304.c
│ ├── 231.c
│ ├── 234.c
│ ├── 236.c
│ ├── 24.c
│ ├── 242.c
│ ├── 2482.c
│ ├── 2501.c
│ ├── 26.c
│ ├── 268.c
│ ├── 27.c
│ ├── 274.c
│ ├── 278.c
│ ├── 28.c
│ ├── 283.c
│ ├── 287.c
│ ├── 29.c
│ ├── 3.c
│ ├── 32.c
│ ├── 344.c
│ ├── 35.c
│ ├── 367.c
│ ├── 37.c
│ ├── 38.c
│ ├── 387.c
│ ├── 389.c
│ ├── 4.c
│ ├── 404.c
│ ├── 42.c
│ ├── 434.c
│ ├── 442.c
│ ├── 45.c
│ ├── 461.c
│ ├── 476.c
│ ├── 485.c
│ ├── 5.c
│ ├── 50.c
│ ├── 509.c
│ ├── 520.c
│ ├── 53.c
│ ├── 540.c
│ ├── 561.c
│ ├── 567.c
│ ├── 6.c
│ ├── 617.c
│ ├── 62.c
│ ├── 63.c
│ ├── 647.c
│ ├── 66.c
│ ├── 669.c
│ ├── 674.c
│ ├── 684.c
│ ├── 69.c
│ ├── 7.c
│ ├── 700.c
│ ├── 701.c
│ ├── 704.c
│ ├── 709.c
│ ├── 75.c
│ ├── 771.c
│ ├── 79.c
│ ├── 8.c
│ ├── 807.c
│ ├── 82.c
│ ├── 83.c
│ ├── 841.c
│ ├── 852.c
│ ├── 876.c
│ ├── 9.c
│ ├── 901.c
│ ├── 905.c
│ ├── 917.c
│ ├── 931.c
│ ├── 938.c
│ ├── 94.c
│ ├── 953.c
│ ├── 965.c
│ ├── 977.c
│ ├── 979.c
│ ├── 98.c
│ ├── 985.c
│ └── 997.c
├── machine_learning/
│ ├── CMakeLists.txt
│ ├── adaline_learning.c
│ ├── k_means_clustering.c
│ ├── kohonen_som_topology.c
│ └── kohonen_som_trace.c
├── math/
│ ├── CMakeLists.txt
│ ├── armstrong_number.c
│ ├── cantor_set.c
│ ├── cartesian_to_polar.c
│ ├── catalan.c
│ ├── collatz.c
│ ├── euclidean_algorithm_extended.c
│ ├── factorial.c
│ ├── factorial_large_number.c
│ ├── factorial_trailing_zeroes.c
│ ├── fibonacci.c
│ ├── fibonacci_dp.c
│ ├── fibonacci_fast.c
│ ├── fibonacci_formula.c
│ ├── gcd.c
│ ├── is_armstrong.c
│ ├── large_factorials.c
│ ├── lcm.c
│ ├── lerp.c
│ ├── palindrome.c
│ ├── prime.c
│ ├── prime_factoriziation.c
│ ├── prime_sieve.c
│ └── strong_number.c
├── misc/
│ ├── CMakeLists.txt
│ ├── demonetization.c
│ ├── hamming_distance.c
│ ├── lexicographic_permutations.c
│ ├── longest_subsequence.c
│ ├── mcnaughton_yamada_thompson.c
│ ├── mirror.c
│ ├── pid.c
│ ├── poly_add.c
│ ├── postfix_evaluation.c
│ ├── quartile.c
│ ├── rselect.c
│ ├── run_length_encoding.c
│ ├── shunting_yard.c
│ ├── sudoku_solver.c
│ ├── tower_of_hanoi.c
│ └── union_find.c
├── numerical_methods/
│ ├── CMakeLists.txt
│ ├── bisection_method.c
│ ├── durand_kerner_roots.c
│ ├── gauss_elimination.c
│ ├── gauss_seidel_method.c
│ ├── lagrange_theorem.c
│ ├── lu_decompose.c
│ ├── mean.c
│ ├── median.c
│ ├── newton_raphson_root.c
│ ├── ode_forward_euler.c
│ ├── ode_midpoint_euler.c
│ ├── ode_semi_implicit_euler.c
│ ├── qr_decompose.h
│ ├── qr_decomposition.c
│ ├── qr_eigen_values.c
│ ├── realtime_stats.c
│ ├── secant_method.c
│ ├── simpsons_1_3rd_rule.c
│ └── variance.c
├── process_scheduling_algorithms/
│ ├── CMakeLists.txt
│ └── non_preemptive_priority_scheduling.c
├── project_euler/
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── problem_1/
│ │ ├── sol1.c
│ │ ├── sol2.c
│ │ ├── sol3.c
│ │ └── sol4.c
│ ├── problem_10/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_12/
│ │ └── sol1.c
│ ├── problem_13/
│ │ ├── num.txt
│ │ └── sol1.c
│ ├── problem_14/
│ │ └── sol1.c
│ ├── problem_15/
│ │ └── sol1.c
│ ├── problem_16/
│ │ └── sol1.c
│ ├── problem_19/
│ │ └── sol1.c
│ ├── problem_2/
│ │ └── so1.c
│ ├── problem_20/
│ │ └── sol1.c
│ ├── problem_21/
│ │ └── sol1.c
│ ├── problem_22/
│ │ ├── names.txt
│ │ └── sol1.c
│ ├── problem_23/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_24/
│ │ └── sol1
│ ├── problem_25/
│ │ └── sol1.c
│ ├── problem_26/
│ │ └── sol1.c
│ ├── problem_3/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_4/
│ │ └── sol.c
│ ├── problem_401/
│ │ └── sol1.c
│ ├── problem_5/
│ │ ├── sol1.c
│ │ ├── sol2.c
│ │ └── sol3.c
│ ├── problem_6/
│ │ └── sol.c
│ ├── problem_7/
│ │ ├── sol.c
│ │ └── sol2.c
│ ├── problem_8/
│ │ ├── digits.txt
│ │ ├── sol1.c
│ │ └── sol2.c
│ └── problem_9/
│ ├── sol1.c
│ └── sol2.c
├── scripts/
│ ├── file_linter.py
│ └── leetcode_directory_md.py
├── searching/
│ ├── CMakeLists.txt
│ ├── binary_search.c
│ ├── exponential_search.c
│ ├── fibonacci_search.c
│ ├── floyd_cycle_detection_algorithm.c
│ ├── interpolation_search.c
│ ├── jump_search.c
│ ├── linear_search.c
│ ├── modified_binary_search.c
│ ├── other_binary_search.c
│ ├── pattern_search/
│ │ ├── CMakeLists.txt
│ │ ├── boyer_moore_search.c
│ │ ├── naive_search.c
│ │ └── rabin_karp_search.c
│ ├── sentinel_linear_search.c
│ └── ternary_search.c
└── sorting/
├── CMakeLists.txt
├── bead_sort.c
├── binary_insertion_sort.c
├── bogo_sort.c
├── bubble_sort.c
├── bubble_sort_2.c
├── bubble_sort_recursion.c
├── bucket_sort.c
├── cocktail_sort.c
├── comb_sort.c
├── counting_sort.c
├── cycle_sort.c
├── gnome_sort.c
├── heap_sort.c
├── heap_sort_2.c
├── insertion_sort.c
├── insertion_sort_recursive.c
├── merge_sort.c
├── merge_sort_nr.c
├── multikey_quick_sort.c
├── odd_even_sort.c
├── pancake_sort.c
├── partition_sort.c
├── patience_sort.c
├── pigeonhole_sort.c
├── quick_sort.c
├── radix_sort.c
├── radix_sort_2.c
├── random_quick_sort.c
├── selection_sort.c
├── selection_sort_recursive.c
├── shaker_sort.c
├── shell_sort.c
├── shell_sort2.c
└── stooge_sort.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
...
================================================
FILE: .clang-tidy
================================================
---
Checks: '-*,google-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.*,openmp-*,performance-*,portability-*,modernize-*'
WarningsAsErrors: '*,-clang-diagnostic-implicitly-unsigned-literal,-google-readability-*,-google-explicit-constructor,-modernize-*,modernize-avoid-c-arrays,-google-explicit-constructor,-performance-move-const-arg,-performance-noexcept-move-constructor,'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: '{ BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 80, AccessModifierOffset: -4 }'
================================================
FILE: .github/CODEOWNERS
================================================
* @Panquesito7 @tjgurwara99 @alexpantyukhin
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug report
description: Create a report to help us improve. Report bugs found while using the project
title: "[BUG]"
labels: [bug]
body:
- type: markdown
attributes:
value: "Provide a general summary of the issue in the Title above"
- type: textarea
id: description
attributes:
label: Description
description: Provide a general summary of the issue in the Title above
validations:
required: true
- type: input
id: expectedbhv
attributes:
label: Expected behavior
description: Tell us what should happen
validations:
required: true
- type: input
id: actualbhv
attributes:
label: Actual behavior
description: Tell us what happens instead
validations:
required: true
- type: input
id: possiblefix
attributes:
label: Possible fix
description: Not obligatory, but suggest a fix or reason for the bug
validations:
required: false
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: |
Provide a link to a live example, or an unambiguous set of steps to
reproduce this bug. Include code to reproduce, if relevant
placeholder: |
1.
2.
3.
4.
validations:
required: true
- type: textarea
id: context
attributes:
label: Context
description: How has this bug affected you? What were you trying to accomplish?
validations:
required: true
- type: textarea
id: extrainformation
attributes:
label: Additional information
description: Is there anything else we should know about this bug?
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Discord community
url: https://the-algorithms.com/discord/
about: Have any questions or found any bugs? Please contact us via Discord
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature request
description: Suggest features, propose improvements, discuss new ideas.
title: "[FEATURE]"
labels: [enhancement]
body:
- type: markdown
attributes:
value: Provide a general summary of the issue in the Title above
- type: textarea
id: description
attributes:
label: Detailed description
description: Provide a detailed description of the change or addition you are proposing
validations:
required: true
- type: textarea
id: context
attributes:
label: Context
description: |
Why is this change important to you? How would you use it?
How can it benefit other users?
validations:
required: true
- type: textarea
id: possibleimpl
attributes:
label: Possible implementation
description: Not obligatory, but suggest an idea for implementing addition or change
validations:
required: false
- type: textarea
id: extrainformation
attributes:
label: Additional information
description: Is there anything else we should know about this feature?
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/other.yml
================================================
name: Other issue
description: Use this for any other issues. Do NOT create blank issues
title: "[OTHER]"
labels: ["awaiting triage"]
body:
- type: textarea
id: description
attributes:
label: What would you like to share?
description: Provide a clear and concise explanation of your issue.
validations:
required: true
- type: textarea
id: extrainfo
attributes:
label: Additional information
description: Is there anything else we should know about this issue?
validations:
required: false
================================================
FILE: .github/labeler.yml
================================================
Leetcode folder changes:
- leetcode/**/*
================================================
FILE: .github/pull_request_template.md
================================================
#### Description of Change
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.
Contributors guide: https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md
-->
#### References
<!-- Add any reference to previous pull-request or issue -->
#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
- [ ] Added description of change
- [ ] Added file name matches [File name guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#File-Name-guidelines)
- [ ] Added tests and example, test must pass
- [ ] Relevant documentation/comments is changed or added
- [ ] PR title follows semantic [commit guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#Commit-Guidelines)
- [ ] Search previous suggestions before making a new one, as yours may be a duplicate.
- [ ] I acknowledge that all my contributions will be made under the project's license.
Notes: <!-- Please add a one-line description for developers or pull request viewers -->
================================================
FILE: .github/workflows/approved-label.yml
================================================
on: pull_request_review
name: Add "approved" label when approved
jobs:
add_label:
name: Add "approved" label when approved
runs-on: ubuntu-latest
steps:
- name: Add "approved" label when approved
uses: pullreminders/label-when-approved-action@master
env:
APPROVALS: "1"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADD_LABEL: "approved"
REMOVE_LABEL: ""
================================================
FILE: .github/workflows/awesome_workflow.yml
================================================
name: Awesome CI Workflow
on: [push, pull_request]
permissions:
contents: write
jobs:
MainSequence:
name: Code Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- name: requirements
run: |
sudo apt-get -qq update
sudo apt-get -qq install clang-tidy clang-format
# checks are passing with less errors when used with this version.
# The default installs v6.0 which did not work out well in my tests
- name: Setup Git Specs
run: |
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions@users.noreply.github.com'
- name: Filename Formatter
uses: TheAlgorithms/scripts/formatter@main
with:
filetypes: .c,.h
- name: Get file changes
run: |
git branch
git diff --diff-filter=dr --name-only origin/master > git_diff.txt
echo "Files changed-- `cat git_diff.txt`"
- name: Configure for static lint checks
# compiling first gives clang-tidy access to all the header files and settings used to compile the programs.
# This will check for macros, if any, on linux and not for Windows. But the use of portability checks should
# be able to catch any errors for other platforms.
run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Lint modified files
shell: bash
run: python3 scripts/file_linter.py
- name: Commit and push changes
run: |
git diff DIRECTORY.md
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
git push origin HEAD:$GITHUB_REF || true
build:
name: Compile checks
runs-on: ${{ matrix.os }}
permissions:
pull-requests: write
needs: [MainSequence]
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: |
cmake -B ./build -S .
cmake --build build --config Release
- name: Label on PR fail
uses: actions/github-script@v6
if: ${{ failure() && matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }}
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Autochecks are failing']
})
================================================
FILE: .github/workflows/codeql.yml
================================================
name: "Code Scanning - Action"
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * 0'
jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
with:
languages: cpp
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ✏️ If the Autobuild fails above, remove it and uncomment the following
# three lines and modify them (or add more) to build your code if your
# project uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
================================================
FILE: .github/workflows/directory_writer.yml
================================================
name: Directory writer
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
if: github.repository == 'TheAlgorithms/C' # We only need this to run in our repository.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build directory
uses: TheAlgorithms/scripts/directory_md@main
with:
language: C
working-directory: .
filetypes: .c,.h
ignored-directories: leetcode/,scripts/
================================================
FILE: .github/workflows/gh-pages.yml
================================================
name: Doxygen CI
on:
push:
branches: [master]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install requirements
run: |
brew install graphviz ninja doxygen
- name: configure
run: cmake -G Ninja -B ./build -S .
- name: build
run: cmake --build build -t doc
- name: gh-pages
uses: actions/checkout@v3
with:
ref: "gh-pages"
clean: false
- name: Move & Commit files
run: |
git config --global user.name github-actions
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
rm -rf d* && rm *.html && rm *.svg && rm *.map && rm *.md5 && rm *.png && rm *.js && rm *.css
git add .
cp -rp ./build/html/* . && rm -rf ./build && ls -lah
git add .
git commit -m "Documentation for $GITHUB_SHA" || true
git push --force || true
================================================
FILE: .github/workflows/labeler.yml
================================================
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
================================================
FILE: .github/workflows/leetcode_directory_writer.yml
================================================
# The objective of this GitHub Action is to update the leetcode DIRECTORY.md file (if needed)
# when doing a git push
name: leetcode_directory_writer
on:
push:
paths:
- "leetcode/src/**.c"
branches:
- master
jobs:
build:
if: github.repository == 'TheAlgorithms/C' # We only need this to run in our repository.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Add python dependencies
run: |
pip install requests
- name: Write LeetCode DIRECTORY.md
run: |
python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md
- name: Setup Git configurations
shell: bash
run: |
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions@users.noreply.github.com'
- name: Committing changes
shell: bash
run: |
git checkout -b leetcode-directory-${{ github.sha }}
git commit -m "docs: updating `leetcode/DIRECTORY.md`"
git push origin leetcode-directory-${{ github.sha }}:leetcode-directory-${{ github.sha }}
- name: Creating the pull request
shell: bash
run: |
if [[ $(git log --branches --not --remotes) ]]; then
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).' || true
fi
env:
GH_TOKEN: ${{ github.token }}
================================================
FILE: .github/workflows/stale.yml
================================================
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '0 0 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
stale-issue-message: 'This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
close-issue-message: 'Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://the-algorithms.com/discord/). Thank you for your contributions!'
stale-pr-message: 'This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
close-pr-message: 'Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://the-algorithms.com/discord/). Thank you for your contributions!'
exempt-issue-labels: 'dont-close,approved'
exempt-pr-labels: 'dont-close,approved'
days-before-stale: 30
days-before-close: 7
================================================
FILE: .gitignore
================================================
*.swp
*.exe
*.out
.vscode/
build/
git_diff.txt
================================================
FILE: .gitpod.dockerfile
================================================
FROM gitpod/workspace-full-vnc
RUN sudo apt-get update \
&& sudo apt-get install -y \
doxygen \
graphviz \
ninja-build \
freeglut3 \
freeglut3-dev \
&& pip install cpplint \
&& sudo rm -rf /var/lib/apt/lists/*
================================================
FILE: .gitpod.yml
================================================
image:
file: .gitpod.dockerfile
github:
prebuilds:
addBadge: true
addComment: false
addCheck: false
master: true
branches: true
pullRequestsFromForks: true
vscode:
extensions:
# - ms-vscode.cpptools
- twxs.cmake
- ms-vscode.cmake-tools
- mhutchie.git-graph
- notskm.clang-tidy
- mitaki28.vscode-clang
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.22)
project(Algorithms_in_C
LANGUAGES C
VERSION 1.0.0
DESCRIPTION "Set of algorithms implemented in C."
)
# Set compilation standards
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED YES)
if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
# add_compile_options(/Za)
endif (MSVC)
# check for math library
# addresses a bug when linking on OSX
find_library(MATH_LIBRARY m)
# Optional flag - can be set by user
# Default "ON"
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
if(USE_OPENMP)
find_package(OpenMP)
if (OpenMP_C_FOUND)
message(STATUS "Building with OpenMP Multithreading.")
else()
message(STATUS "No OpenMP found, no multithreading.")
endif()
endif()
## Check for some required header files
include(CheckIncludeFile)
include(CheckSymbolExists)
check_include_file(stdbool.h HAS_STDBOOL_H)
check_include_file(inttypes.h HAS_INTTYPES_H)
check_include_file(complex.h HAS_COMPLEX_H)
if(HAS_COMPLEX_H)
check_symbol_exists(complex complex.h HAS_COMPLEX_TYPE)
endif(HAS_COMPLEX_H)
if (NOT HAS_STDBOOL_H)
message(FATAL_ERROR "Missing required header: 'stdbool.h'")
endif()
if (NOT HAS_INTTYPES_H)
message(FATAL_ERROR "Missing required header: 'inttypes.h'")
endif()
## Add subdirectories containing CMakeLists.txt
# to configure and compile files in the respective folders
add_subdirectory(developer_tools)
add_subdirectory(hash)
add_subdirectory(misc)
add_subdirectory(games)
add_subdirectory(audio)
add_subdirectory(sorting)
add_subdirectory(geometry)
add_subdirectory(graphics)
add_subdirectory(searching)
add_subdirectory(conversions)
add_subdirectory(client_server)
add_subdirectory(project_euler)
add_subdirectory(machine_learning)
add_subdirectory(process_scheduling_algorithms)
add_subdirectory(numerical_methods)
add_subdirectory(math)
add_subdirectory(cipher)
add_subdirectory(dynamic_programming)
## Configure Doxygen documentation system
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
find_package(Doxygen OPTIONAL_COMPONENTS dot dia)
if(DOXYGEN_FOUND)
set(DOXYGEN_GENERATE_MAN NO)
set(DOXYGEN_USE_MATHJAX YES)
set(DOXYGEN_GENERATE_HTML YES)
# set(DOXYGEN_HTML_TIMESTAMP YES)
set(DOXYGEN_EXTRACT_STATIC YES)
set(DOXYGEN_INLINE_SOURCES YES)
set(DOXYGEN_CREATE_SUBDIRS YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_STRIP_CODE_COMMENTS NO)
set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_EXT_LINKS_IN_WINDOW YES)
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
set(DOXYGEN_FILE_PATTERNS *.c *.h *.md)
set(DOXYGEN_MATHJAX_EXTENSIONS TeX/AMSmath TeX/AMSsymbols)
set(DOXYGEN_TAGFILES "doc/cppreference-doxygen-web.tag.xml=http://en.cppreference.com/w/")
set(DOXYGEN_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML")
if(Doxygen_dot_FOUND)
set(DOXYGEN_HAVE_DOT YES)
set(DOXYGEN_CALL_GRAPH YES)
set(DOXYGEN_INTERACTIVE_SVG YES)
set(DOXYGEN_DOT_IMAGE_FORMAT "svg")
endif()
if(OPENMP_FOUND)
set(DOXYGEN_PREDEFINED "_OPENMP=1")
endif()
if(GLUT_FOUND)
set(DOXYGEN_PREDEFINED ${DOXYGEN_PREDEFINED} "GLUT_FOUND=1")
endif()
doxygen_add_docs(
doc
${PROJECT_SOURCE_DIR}
COMMENT "Generate documentation"
)
endif()
## Enable tool to generate binary distribution files
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
hello@the-algorithms.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
================================================
FILE: CONTRIBUTING.md
================================================
# CONTRIBUTION GUIDELINES
## Before contributing
Welcome to [TheAlgorithms/C](https://github.com/TheAlgorithms/C)! Before submitting pull requests, please make sure that you have **read the whole guidelines**. If you have any doubts about this contribution guide, please open [an issue](https://github.com/TheAlgorithms/C/issues/new/choose) or ask on our [Discord server](https://the-algorithms.com/discord/), and clearly state your concerns.
## Contributing
### Maintainer/reviewer
**Please check the [reviewer code](https://github.com/TheAlgorithms/C/blob/master/REVIEWER_CODE.md) file for maintainers and reviewers.**
### Contributor
Being a contributor at The Algorithms, we request you to follow the points mentioned below:
- You did your own work.
- No plagiarism is allowed. Any plagiarized work will not be merged.
- Your work will be distributed under the [GNU General Public License v3.0](https://github.com/TheAlgorithms/C/blob/master/LICENSE) once your pull request has been merged.
- Please follow the repository guidelines and standards mentioned below.
**New implementation** New implementations are welcome!
You can add new algorithms or data structures that are **not present in the repository** or that can **improve** the old implementations (**documentation**, **improving test cases**, removing bugs, or in any other reasonable sense)
**Issues** Please avoid opening issues asking to be "assigned” to a particular algorithm. This merely creates unnecessary noise for maintainers. Instead, please submit your implementation in a pull request, and it will be evaluated by project maintainers.
### LeetCode solutions
For LeetCode solutions, please check its [**guide**](https://github.com/TheAlgorithms/C/blob/master/leetcode/README.md) to make a proper solution file.
### Making Changes
#### Code
- Please use the directory structure of the repository.
- Make sure the file extensions should be `*.h` `*.c`
- Organize your code using the **`struct`** keyword
- If an implementation of the algorithm already exists, please refer to the [file-name section below](#file-name-guidelines).
- You can suggest reasonable changes to existing algorithms.
- Strictly use snake_case (underscore_separated) in filenames.
- If you have added or modified code, please make sure the code compiles before submitting.
- Our automated testing runs [**CMake**](https://cmake.org/) on all the pull requests, so please be sure that your code passes before submitting.
- Please conform to [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and document the code as much as possible. This not only facilitates the readers but also generates the correct info on the website.
- **Be consistent in the use of these guidelines.**
#### Documentation
- Make sure you put useful comments in your code. Do not comment on obvious things.
- Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure. If you want to create a new directory, then please check if a similar category has been recently suggested or created by other pull requests.
- If you have modified/added documentation, please ensure that your language is concise and must not contain grammatical errors.
- Do not update [`README.md`](https://github.com/TheAlgorithms/C/blob/master/README.md) along with other changes. First, create an issue and then link to that issue in your pull request to suggest specific changes required to [`README.md`](https://github.com/TheAlgorithms/C/blob/master/README.md).
- The repository follows [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and auto-generates the [repository website](https://thealgorithms.github.io/C). Please ensure the code is documented in this structure. A sample implementation is given below.
#### Test
- Make sure to add examples and test cases in your `main()` function.
- If you find an algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
- Please try to add one or more `test()` functions that will invoke the algorithm implementation on random test data with the expected output. Use the `assert()` function to confirm that the tests will pass. Requires including the `assert.h` library.
- Test cases should fully verify that your program works as expected. Rather than asking the user for input, it's best to make sure the given output is the correct output.
##### Self-test examples
1. [ROT13 Cipher](https://github.com/TheAlgorithms/C/blob/master/cipher/rot13.c) (complex).
```c
// NOTE: the `rot13` function is defined in another part of the code.
char test_01[] = "The more I C, the less I see.";
rot13(test_01);
assert(strcmp(test_01, "Gur zber V P, gur yrff V frr.") == 0);
char test_02[] = "Which witch switched the Swiss wristwatches?";
rot13(test_02);
assert(strcmp(test_02, "Juvpu jvgpu fjvgpurq gur Fjvff jevfgjngpurf?") == 0);
char test_03[] = "Juvpu jvgpu fjvgpurq gur Fjvff jevfgjngpurf?";
rot13(test_03);
assert(strcmp(test_03, "Which witch switched the Swiss wristwatches?") == 0);
```
2. [Sudoku Solver](https://github.com/TheAlgorithms/C/blob/master/misc/sudoku_solver.c) (medium).
```c
uint8_t test_array[] = {3, 0, 6, 5, 0, 8, 4, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0,
0, 0, 8, 7, 0, 0, 0, 0, 3, 1, 0, 0, 3, 0, 1, 0, 0,
8, 0, 9, 0, 0, 8, 6, 3, 0, 0, 5, 0, 5, 0, 0, 9, 0,
6, 0, 0, 1, 3, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0,
0, 0, 7, 4, 0, 0, 5, 2, 0, 6, 3, 0, 0};
struct sudoku a = {.N = 9, .N2 = 3, .a = test_array};
assert(solve(&a)); // ensure that solution is obtained
// NOTE: `solve` is defined in another part of the code.
uint8_t expected[] = {3, 1, 6, 5, 7, 8, 4, 9, 2, 5, 2, 9, 1, 3, 4, 7, 6,
8, 4, 8, 7, 6, 2, 9, 5, 3, 1, 2, 6, 3, 4, 1, 5, 9,
8, 7, 9, 7, 4, 8, 6, 3, 1, 2, 5, 8, 5, 1, 7, 9, 2,
6, 4, 3, 1, 3, 8, 9, 4, 7, 2, 5, 6, 6, 9, 2, 3, 5,
1, 8, 7, 4, 7, 4, 5, 2, 8, 6, 3, 1, 9};
for (int i = 0; i < a.N; i++)
for (int j = 0; j < a.N; j++)
assert(a.a[i * a.N + j] == expected[i * a.N + j]);
```
3. Small C program that showcases and explains the use of tests.
```c
#include <stdio.h> /// for IO operations
#include <assert.h> /// for assert
#include <stdbool.h> /// for bool
/**
* @brief Verifies if the given array
* contains the given number on it.
* @param arr the array to be used for checking
* @param number the number to check if it's inside the array
* @return false if the number was NOT found in the array
* @return true if the number WAS found in the array
*/
bool is_number_on_array(const int *arr, const int number) {
for (int i = 0; i < sizeof(arr); i++) {
if (arr[i] == number) {
return true;
}
else {
// Number not in the current index, keep searching.
}
}
return false;
}
/**
* @brief Self-test implementations
* @returns void
*/
static void tests() {
int arr[] = { 9, 14, 21, 98, 67 };
assert(is_number_on_array(arr, 9) == true);
assert(is_number_on_array(arr, 4) == false);
assert(is_number_on_array(arr, 98) == true);
assert(is_number_on_array(arr, 512) == false);
printf("All tests have successfully passed!\n");
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
tests(); // run self-test implementations
return 0;
}
```
#### Typical structure of a program
```c
/**
* @file
* @brief Add one line description here. Should contain a Wikipedia
* link or another source explaining the algorithm/implementation.
* @details
* This is a multi-line
* description containing links, references,
* math equations, etc.
* @author [Name](https://github.com/handle)
* @see related_file.c, another_file.c
*/
#include <assert.h> /// for assert
#include /// for `some function here`
/**
* @brief Struct documentation
*/
struct struct_name {
int variable; ///< short info of this variable
char message; ///< short info
};
/**
* @brief Function documentation
* @param param1 one-line info about param1
* @param param2 one-line info about param2
* @returns `true` if ...
* @returns `false` if ...
*/
bool func(int param1, int param2) {
// function statements here
if (/*something bad*/) {
return false;
}
return true;
}
/**
* @brief Self-test implementations
* @returns void
*/
static void test() {
/* desciptions of the following test */
assert(func(...) == ...); // this ensures that the algorithm works as expected
// can have multiple checks
// this lets the user know that the tests passed
printf("All tests have successfully passed!\n");
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
test(); // run self-test implementations
// code here
return 0;
}
```
#### File name guidelines
- Use lowercase words with ``"_"`` as a separator
- For instance
```markdown
MyNewCStruct.C is incorrect
my_new_c_struct.c is correct format
```
- It will be used to dynamically create a directory of files and implementation.
- File name validation will run on Docker to ensure validity.
- If an implementation of the algorithm already exists and your version is different from that implemented, please use an incremental numeric digit as a suffix. For example: if `median_search.c` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `median_search2.c`. For a third implementation, `median_search3.c`, and so on.
#### Directory guidelines
- We recommend adding files to existing directories as much as possible.
- Use lowercase words with ``"_"`` as a separator ( no spaces or ```"-"``` allowed )
- For instance
```markdown
SomeNew Fancy-Category is incorrect
some_new_fancy_category is correct
```
- Filepaths will be used to dynamically create a directory of our algorithms.
- Filepath validation will run on GitHub Actions to ensure compliance.
##### Integrating CMake in a new directory
In case a new directory is 100% required, `CMakeLists.txt` file in the root directory needs to be updated, and a new `CMakeLists.txt` file needs to be created within the new directory.
An example of how your new `CMakeLists.txt` file should look like. Note that if there are any extra libraries/setup required, you must include that in this file as well.
```cmake
# 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/<foldername>") # Folder name. Do NOT include `<>`
endforeach( testsourcefile ${APP_SOURCES} )
```
The `CMakeLists.txt` file in the root directory should be updated to include the new directory.\
Include your new directory after the last subdirectory. Example:
```cmake
...
add_subdirectory(numerical_methods)
add_subdirectory(<foldername>)
```
#### Commit Guidelines
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilled across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.
```bash
git add file_xyz.c
git commit -m "your message"
```
Examples of commit messages with semantic prefixes:
```markdown
fix: xyz algorithm bug
feat: add xyx algorithm, struct xyz
test: add test for xyz algorithm
docs: add comments and explanation to xyz algorithm
chore: update Gitpod badge
```
Common prefixes:
- fix: A bug fix
- feat: A new feature
- docs: Documentation changes
- test: Correct existing tests or add new ones
- chore: Miscellaneous changes that do not match any of the above.
### Pull Requests
- Checkout our [pull request template](https://github.com/TheAlgorithms/C/blob/master/.github/pull_request_template.md)
#### Building Locally
Before submitting a pull request, build the code locally or using the convenient [](https://gitpod.io/#https://github.com/TheAlgorithms/C) service.
```bash
cmake -B build -S .
```
#### Static Code Analyzer
We use [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) as a static code analyzer with a configuration in [`.clang-tidy`](.clang-tidy).
```bash
clang-tidy --fix --quiet -p build subfolder/file_to_check.c --
```
#### Code Formatter
[**`clang-format`**](https://clang.llvm.org/docs/ClangFormat.html) is used for code formatting.
- Installation (only needs to be installed once.)
- Mac (using home-brew): `brew install clang-format`
- Mac (using macports): `sudo port install clang-10 +analyzer`
- Windows (MSYS2 64-bit): `pacman -S mingw-w64-x86_64-clang-tools-extra`
- Linux (Debian): `sudo apt-get install clang-format-10 clang-tidy-10`
- Running (all platforms): `clang-format -i -style="file" my_file.c`
#### GitHub Actions
- Enable GitHub Actions on your fork of the repository.
After enabling, it will execute `clang-tidy` and `clang-format` after every push (not a commit).
- Click on the tab "Actions", then click on the big green button to enable it.

- The result can create another commit if the actions made any changes on your behalf.
- Hence, it is better to wait and check the results of GitHub Actions after every push.
- Run `git pull` in your local clone if these actions made many changes to avoid merge conflicts.
Most importantly,
- Happy coding!
================================================
FILE: CodingGuidelines.md
================================================
# Code style convention
Please orient on this guide before you sent a pull request.
---
## User-interface
Please write a simple user interface for your programs. Not a blinking cursor!
What does the program do?
What want the program an user informations?
---
## Code style conventions
See [here](https://users.ece.cmu.edu/~eno/coding/CCodingStandard.html)
Don't push all code in one line!
================================================
FILE: DIRECTORY.md
================================================
## Audio
* [Alaw](https://github.com/TheAlgorithms/C/blob/HEAD/audio/alaw.c)
## Cipher
* [Affine](https://github.com/TheAlgorithms/C/blob/HEAD/cipher/affine.c)
* [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/cipher/rot13.c)
## Client Server
* [Bool](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/bool.h)
* [Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/client.c)
* [Fork](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/fork.h)
* [Remote Command Exec Udp Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_client.c)
* [Remote Command Exec Udp Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_server.c)
* [Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/server.c)
* [Tcp Full Duplex Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/tcp_full_duplex_client.c)
* [Tcp Full Duplex Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/tcp_full_duplex_server.c)
* [Tcp Half Duplex Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/tcp_half_duplex_client.c)
* [Tcp Half Duplex Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/tcp_half_duplex_server.c)
* [Udp Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/udp_client.c)
* [Udp Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/udp_server.c)
## Conversions
* [Binary To Decimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/binary_to_decimal.c)
* [Binary To Hexadecimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/binary_to_hexadecimal.c)
* [Binary To Octal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/binary_to_octal.c)
* [C Atoi Str To Integer](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/c_atoi_str_to_integer.c)
* [Celsius To Fahrenheit](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/celsius_to_fahrenheit.c)
* [Decimal To Any Base](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_any_base.c)
* [Decimal To Binary](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_binary.c)
* [Decimal To Binary Recursion](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_binary_recursion.c)
* [Decimal To Hexa](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_hexa.c)
* [Decimal To Octal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_octal.c)
* [Decimal To Octal Recursion](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/decimal_to_octal_recursion.c)
* [Hexadecimal To Octal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/hexadecimal_to_octal.c)
* [Hexadecimal To Octal2](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/hexadecimal_to_octal2.c)
* [Infix To Postfix](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/infix_to_postfix.c)
* [Infix To Postfix2](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/infix_to_postfix2.c)
* [Int To String](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/int_to_string.c)
* [Octal To Binary](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/octal_to_binary.c)
* [Octal To Decimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/octal_to_decimal.c)
* [Octal To Hexadecimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/octal_to_hexadecimal.c)
* [Roman Numerals To Decimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/roman_numerals_to_decimal.c)
* [To Decimal](https://github.com/TheAlgorithms/C/blob/HEAD/conversions/to_decimal.c)
## Data Structures
* Array
* [Carray](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/array/carray.c)
* [Carray](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/array/carray.h)
* [Carray Tests](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/array/carray_tests.c)
* Binary Trees
* [Avl Tree](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/avl_tree.c)
* [Binary Search Tree](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/binary_search_tree.c)
* [Create Node](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/create_node.c)
* [Recursive Traversals](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/recursive_traversals.c)
* [Red Black Tree](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/red_black_tree.c)
* [Segment Tree](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/segment_tree.c)
* [Threaded Binary Trees](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/threaded_binary_trees.c)
* [Words Alphabetical](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/binary_trees/words_alphabetical.c)
* Dictionary
* [Dict](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dictionary/dict.c)
* [Dict](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dictionary/dict.h)
* [Test Program](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dictionary/test_program.c)
* Dynamic Array
* [Dynamic Array](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dynamic_array/dynamic_array.c)
* [Dynamic Array](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dynamic_array/dynamic_array.h)
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/dynamic_array/main.c)
* Graphs
* [Bellman Ford](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/bellman_ford.c)
* [Bfs](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/bfs.c)
* [Bfs Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/bfs_queue.c)
* [Dfs](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/dfs.c)
* [Dfs Recursive](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/dfs_recursive.c)
* [Dijkstra](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/dijkstra.c)
* [Euler](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/euler.c)
* [Floyd Warshall](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/floyd_warshall.c)
* [Graph](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/graph.c)
* [Graph](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/graph.h)
* [Hamiltonian](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/hamiltonian.c)
* [Kruskal](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/kruskal.c)
* [Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/queue.c)
* [Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/queue.h)
* [Strongly Connected Components](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/strongly_connected_components.c)
* [Topological Sort](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/topological_sort.c)
* [Transitive Closure](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/graphs/transitive_closure.c)
* Hash Set
* [Hash Set](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/hash_set/hash_set.c)
* [Hash Set](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/hash_set/hash_set.h)
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/hash_set/main.c)
* Heap
* [Max Heap](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/heap/max_heap.c)
* [Min Heap](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/heap/min_heap.c)
* Linked List
* [Ascending Priority Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/ascending_priority_queue.c)
* [Circular Doubly Linked List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/circular_doubly_linked_list.c)
* [Circular Linked List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/circular_linked_list.c)
* [Doubly Linked List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/doubly_linked_list.c)
* [Merge Linked Lists](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/merge_linked_lists.c)
* [Middle Element In List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/middle_element_in_list.c)
* [Queue Linked List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/queue_linked_list.c)
* [Singly Link List Deletion](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/singly_link_list_deletion.c)
* [Stack Using Linked Lists](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/linked_list/stack_using_linked_lists.c)
* List
* [List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/list/list.c)
* [List](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/list/list.h)
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/list/main.c)
* Queue
* [Include](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/queue/include.h)
* [Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/queue/queue.c)
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack.c)
* Stack
* [Dynamic Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/dynamic_stack.c)
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/main.c)
* [Parenthesis](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/parenthesis.c)
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack.c)
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack.h)
* Stack Linked List
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack_linked_list/main.c)
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack_linked_list/stack.c)
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack_linked_list/stack.h)
* Trie
* [Trie](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/trie/trie.c)
* [Vector](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/vector.c)
## Developer Tools
* [Malloc Dbg](https://github.com/TheAlgorithms/C/blob/HEAD/developer_tools/malloc_dbg.c)
* [Malloc Dbg](https://github.com/TheAlgorithms/C/blob/HEAD/developer_tools/malloc_dbg.h)
* [Min Printf](https://github.com/TheAlgorithms/C/blob/HEAD/developer_tools/min_printf.h)
* [Test Malloc Dbg](https://github.com/TheAlgorithms/C/blob/HEAD/developer_tools/test_malloc_dbg.c)
* [Test Min Printf](https://github.com/TheAlgorithms/C/blob/HEAD/developer_tools/test_min_printf.c)
## Dynamic Programming
* [Lcs](https://github.com/TheAlgorithms/C/blob/HEAD/dynamic_programming/lcs.c)
* [Matrix Chain Order](https://github.com/TheAlgorithms/C/blob/HEAD/dynamic_programming/matrix_chain_order.c)
## Exercism
* Acronym
* [Acronym](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/acronym/acronym.c)
* [Acronym](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/acronym/acronym.h)
* Hello World
* [Hello World](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/hello_world/hello_world.c)
* [Hello World](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/hello_world/hello_world.h)
* Isogram
* [Isogram](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/isogram/isogram.c)
* [Isogram](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/isogram/isogram.h)
* Rna Transcription
* [Rna Transcription](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/rna_transcription/rna_transcription.c)
* [Rna Transcription](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/rna_transcription/rna_transcription.h)
* Word Count
* [Word Count](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/word_count/word_count.c)
* [Word Count](https://github.com/TheAlgorithms/C/blob/HEAD/exercism/word_count/word_count.h)
## Games
* [Hangman](https://github.com/TheAlgorithms/C/blob/HEAD/games/hangman.c)
* [Naval Battle](https://github.com/TheAlgorithms/C/blob/HEAD/games/naval_battle.c)
* [Tic Tac Toe](https://github.com/TheAlgorithms/C/blob/HEAD/games/tic_tac_toe.c)
## Geometry
* [Geometry Datatypes](https://github.com/TheAlgorithms/C/blob/HEAD/geometry/geometry_datatypes.h)
* [Quaternions](https://github.com/TheAlgorithms/C/blob/HEAD/geometry/quaternions.c)
* [Vectors 3D](https://github.com/TheAlgorithms/C/blob/HEAD/geometry/vectors_3d.c)
## Graphics
* [Spirograph](https://github.com/TheAlgorithms/C/blob/HEAD/graphics/spirograph.c)
## Greedy Approach
* [Dijkstra](https://github.com/TheAlgorithms/C/blob/HEAD/greedy_approach/dijkstra.c)
* [Prim](https://github.com/TheAlgorithms/C/blob/HEAD/greedy_approach/prim.c)
## Hash
* [Hash Adler32](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_adler32.c)
* [Hash Blake2B](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_blake2b.c)
* [Hash Crc32](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_crc32.c)
* [Hash Djb2](https://github.com/TheAlgorithms/C/blob/HEAD/hash/hash_djb2.c)
* [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)
## 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)
* [Kohonen Som Topology](https://github.com/TheAlgorithms/C/blob/HEAD/machine_learning/kohonen_som_topology.c)
* [Kohonen Som Trace](https://github.com/TheAlgorithms/C/blob/HEAD/machine_learning/kohonen_som_trace.c)
## Math
* [Armstrong Number](https://github.com/TheAlgorithms/C/blob/HEAD/math/armstrong_number.c)
* [Cantor Set](https://github.com/TheAlgorithms/C/blob/HEAD/math/cantor_set.c)
* [Cartesian To Polar](https://github.com/TheAlgorithms/C/blob/HEAD/math/cartesian_to_polar.c)
* [Catalan](https://github.com/TheAlgorithms/C/blob/HEAD/math/catalan.c)
* [Collatz](https://github.com/TheAlgorithms/C/blob/HEAD/math/collatz.c)
* [Euclidean Algorithm Extended](https://github.com/TheAlgorithms/C/blob/HEAD/math/euclidean_algorithm_extended.c)
* [Factorial](https://github.com/TheAlgorithms/C/blob/HEAD/math/factorial.c)
* [Factorial Large Number](https://github.com/TheAlgorithms/C/blob/HEAD/math/factorial_large_number.c)
* [Factorial Trailing Zeroes](https://github.com/TheAlgorithms/C/blob/HEAD/math/factorial_trailing_zeroes.c)
* [Fibonacci](https://github.com/TheAlgorithms/C/blob/HEAD/math/fibonacci.c)
* [Fibonacci Dp](https://github.com/TheAlgorithms/C/blob/HEAD/math/fibonacci_dp.c)
* [Fibonacci Fast](https://github.com/TheAlgorithms/C/blob/HEAD/math/fibonacci_fast.c)
* [Fibonacci Formula](https://github.com/TheAlgorithms/C/blob/HEAD/math/fibonacci_formula.c)
* [Gcd](https://github.com/TheAlgorithms/C/blob/HEAD/math/gcd.c)
* [Is Armstrong](https://github.com/TheAlgorithms/C/blob/HEAD/math/is_armstrong.c)
* [Large Factorials](https://github.com/TheAlgorithms/C/blob/HEAD/math/large_factorials.c)
* [Lcm](https://github.com/TheAlgorithms/C/blob/HEAD/math/lcm.c)
* [Lerp](https://github.com/TheAlgorithms/C/blob/HEAD/math/lerp.c)
* [Palindrome](https://github.com/TheAlgorithms/C/blob/HEAD/math/palindrome.c)
* [Prime](https://github.com/TheAlgorithms/C/blob/HEAD/math/prime.c)
* [Prime Factoriziation](https://github.com/TheAlgorithms/C/blob/HEAD/math/prime_factoriziation.c)
* [Prime Sieve](https://github.com/TheAlgorithms/C/blob/HEAD/math/prime_sieve.c)
* [Strong Number](https://github.com/TheAlgorithms/C/blob/HEAD/math/strong_number.c)
## Misc
* [Demonetization](https://github.com/TheAlgorithms/C/blob/HEAD/misc/demonetization.c)
* [Hamming Distance](https://github.com/TheAlgorithms/C/blob/HEAD/misc/hamming_distance.c)
* [Lexicographic Permutations](https://github.com/TheAlgorithms/C/blob/HEAD/misc/lexicographic_permutations.c)
* [Longest Subsequence](https://github.com/TheAlgorithms/C/blob/HEAD/misc/longest_subsequence.c)
* [Mcnaughton Yamada Thompson](https://github.com/TheAlgorithms/C/blob/HEAD/misc/mcnaughton_yamada_thompson.c)
* [Mirror](https://github.com/TheAlgorithms/C/blob/HEAD/misc/mirror.c)
* [Pid](https://github.com/TheAlgorithms/C/blob/HEAD/misc/pid.c)
* [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)
* [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)
* [Sudoku Solver](https://github.com/TheAlgorithms/C/blob/HEAD/misc/sudoku_solver.c)
* [Tower Of Hanoi](https://github.com/TheAlgorithms/C/blob/HEAD/misc/tower_of_hanoi.c)
* [Union Find](https://github.com/TheAlgorithms/C/blob/HEAD/misc/union_find.c)
## Numerical Methods
* [Bisection Method](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/bisection_method.c)
* [Durand Kerner Roots](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/durand_kerner_roots.c)
* [Gauss Elimination](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/gauss_elimination.c)
* [Gauss Seidel Method](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/gauss_seidel_method.c)
* [Lagrange Theorem](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/lagrange_theorem.c)
* [Lu Decompose](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/lu_decompose.c)
* [Mean](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/mean.c)
* [Median](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/median.c)
* [Newton Raphson Root](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/newton_raphson_root.c)
* [Ode Forward Euler](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/ode_forward_euler.c)
* [Ode Midpoint Euler](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/ode_midpoint_euler.c)
* [Ode Semi Implicit Euler](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/ode_semi_implicit_euler.c)
* [Qr Decompose](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/qr_decompose.h)
* [Qr Decomposition](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/qr_decomposition.c)
* [Qr Eigen Values](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/qr_eigen_values.c)
* [Realtime Stats](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/realtime_stats.c)
* [Secant Method](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/secant_method.c)
* [Simpsons 1 3Rd Rule](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/simpsons_1_3rd_rule.c)
* [Variance](https://github.com/TheAlgorithms/C/blob/HEAD/numerical_methods/variance.c)
## Process Scheduling Algorithms
* [Non Preemptive Priority Scheduling](https://github.com/TheAlgorithms/C/blob/HEAD/process_scheduling_algorithms/non_preemptive_priority_scheduling.c)
## Project Euler
* Problem 1
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_1/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_1/sol2.c)
* [Sol3](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_1/sol3.c)
* [Sol4](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_1/sol4.c)
* Problem 10
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_10/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_10/sol2.c)
* Problem 12
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_12/sol1.c)
* Problem 13
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_13/sol1.c)
* Problem 14
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_14/sol1.c)
* Problem 15
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_15/sol1.c)
* Problem 16
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_16/sol1.c)
* Problem 19
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_19/sol1.c)
* Problem 2
* [So1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_2/so1.c)
* Problem 20
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_20/sol1.c)
* Problem 21
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_21/sol1.c)
* Problem 22
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_22/sol1.c)
* Problem 23
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_23/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_23/sol2.c)
* Problem 25
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_25/sol1.c)
* Problem 26
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_26/sol1.c)
* Problem 3
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_3/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_3/sol2.c)
* Problem 4
* [Sol](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_4/sol.c)
* Problem 401
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_401/sol1.c)
* Problem 5
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_5/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_5/sol2.c)
* [Sol3](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_5/sol3.c)
* Problem 6
* [Sol](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_6/sol.c)
* Problem 7
* [Sol](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_7/sol.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_7/sol2.c)
* Problem 8
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_8/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_8/sol2.c)
* Problem 9
* [Sol1](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_9/sol1.c)
* [Sol2](https://github.com/TheAlgorithms/C/blob/HEAD/project_euler/problem_9/sol2.c)
## Searching
* [Binary Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/binary_search.c)
* [Exponential Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/exponential_search.c)
* [Fibonacci Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/fibonacci_search.c)
* [Floyd Cycle Detection Algorithm](https://github.com/TheAlgorithms/C/blob/HEAD/searching/floyd_cycle_detection_algorithm.c)
* [Interpolation Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/interpolation_search.c)
* [Jump Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/jump_search.c)
* [Linear Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/linear_search.c)
* [Modified Binary Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/modified_binary_search.c)
* [Other Binary Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/other_binary_search.c)
* Pattern Search
* [Boyer Moore Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/pattern_search/boyer_moore_search.c)
* [Naive Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/pattern_search/naive_search.c)
* [Rabin Karp Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/pattern_search/rabin_karp_search.c)
* [Sentinel Linear Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/sentinel_linear_search.c)
* [Ternary Search](https://github.com/TheAlgorithms/C/blob/HEAD/searching/ternary_search.c)
## Sorting
* [Bead Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bead_sort.c)
* [Binary Insertion Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/binary_insertion_sort.c)
* [Bogo Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bogo_sort.c)
* [Bubble Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bubble_sort.c)
* [Bubble Sort 2](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bubble_sort_2.c)
* [Bubble Sort Recursion](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bubble_sort_recursion.c)
* [Bucket Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/bucket_sort.c)
* [Cocktail Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/cocktail_sort.c)
* [Comb Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/comb_sort.c)
* [Counting Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/counting_sort.c)
* [Cycle Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/cycle_sort.c)
* [Gnome Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/gnome_sort.c)
* [Heap Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/heap_sort.c)
* [Heap Sort 2](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/heap_sort_2.c)
* [Insertion Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/insertion_sort.c)
* [Insertion Sort Recursive](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/insertion_sort_recursive.c)
* [Merge Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/merge_sort.c)
* [Merge Sort Nr](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/merge_sort_nr.c)
* [Multikey Quick Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/multikey_quick_sort.c)
* [Odd Even Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/odd_even_sort.c)
* [Pancake Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/pancake_sort.c)
* [Partition Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/partition_sort.c)
* [Patience Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/patience_sort.c)
* [Pigeonhole Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/pigeonhole_sort.c)
* [Quick Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/quick_sort.c)
* [Radix Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/radix_sort.c)
* [Radix Sort 2](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/radix_sort_2.c)
* [Random Quick Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/random_quick_sort.c)
* [Selection Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/selection_sort.c)
* [Selection Sort Recursive](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/selection_sort_recursive.c)
* [Shaker Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/shaker_sort.c)
* [Shell Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/shell_sort.c)
* [Shell Sort2](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/shell_sort2.c)
* [Stooge Sort](https://github.com/TheAlgorithms/C/blob/HEAD/sorting/stooge_sort.c)
================================================
FILE: Doxyfile
================================================
#
# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!
#
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = Algorithms_in_C
PROJECT_NUMBER = 1.0.0
PROJECT_BRIEF = "Set of algorithms implemented in C."
PROJECT_LOGO =
OUTPUT_DIRECTORY = /Users/kvedala/GitHub/C/build
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
OUTPUT_TEXT_DIRECTION = None
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" "The $name widget" "The $name file" is provides specifies contains represents a an the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
INPUT = /Users/kvedala/GitHub/C
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.doc *.txt *.py *.pyw *.f90 *.f95 *.f03 *.f08 *.f18 *.f *.for *.vhd *.vhdl *.ucf *.qsf *.ice
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */.git/* */.svn/* */.hg/* */CMakeFiles/* */_CPack_Packages/* DartConfiguration.tcl CMakeLists.txt CMakeCache.txt
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
SOURCE_BROWSER = NO
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = YES
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME =
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_PATH = /Users/kvedala/anaconda3/bin
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = YES
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
================================================
FILE: LICENSE
================================================
Copyright (C) 2016-2023 TheAlgorithms and contributors
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: README.md
================================================
# The Algorithms - C # {#mainpage}
<!-- the suffix in the above line is required for doxygen to consider this as the index page of the generated documentation site -->
[](https://gitpod.io/#https://github.com/TheAlgorithms/C)
[](https://github.com/TheAlgorithms/C/actions/workflows/codeql_analysis.yml)
[](https://gitter.im/TheAlgorithms)
[](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md)

[](https://TheAlgorithms.github.io/C)
[](https://github.com/TheAlgorithms/C/actions?query=workflow%3A%22Awesome+CI+Workflow%22)
[](https://liberapay.com/TheAlgorithms)
[](https://the-algorithms.com/discord/)
[](https://liberapay.com/TheAlgorithms/donate)
## Overview
The repository is a collection of open-source implementations of a variety of algorithms implemented in C and licensed under [GPLv3 License](https://github.com/TheAlgorithms/C/blob/master/LICENSE). The algorithms span a variety of topics from computer science, mathematics and statistics, data science, machine learning, engineering, etc.. The implementations and their associated documentations 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 different algorithm strategies and optimizations.
## Features
* The repository provides implementations of various algorithms in one of the most fundamental general purpose languages - [C](https://en.wikipedia.org/wiki/C_(programming_language)).
* Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
* Each source code is atomic using standard C library [`libc`](https://en.wikipedia.org/wiki/C_standard_library) 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](https://github.com/TheAlgorithms/C/actions?query=workflow%3A%22Awesome+CI+Workflow%22) for every commit on the latest versions of two major operating systems viz., MacOS and Ubuntu (Linux) using AppleClang 14.0.0 and GNU 11.3.0 respectively.
* Strict adherence to [C11](https://en.wikipedia.org/wiki/C11_(C_standard_revision)) 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](https://TheAlgorithms.github.io/C) 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.
Click on [Files menu](https://TheAlgorithms.github.io/C/files.html) to see the list of all the files documented with the code.
[Documentation of Algorithms in C](https://thealgorithms.github.io/C) by [The Algorithms Contributors](https://github.com/TheAlgorithms/C/graphs/contributors) is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1)<br/>
<a href="https://creativecommons.org/licenses/by-sa/4.0"><img alt="Creative Commons License" style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" /><img alt="Credit must be given to the creator" style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg" /><img alt="Adaptations must be shared under the same terms" style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" /></a>
## Contributions
As a community developed and maintained repository, we welcome new un-plagiarized quality contributions. Please read our [Contribution Guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md).
================================================
FILE: REVIEWER_CODE.md
================================================
# Guidelines for reviewers and maintainers
Following are some guidelines for contributors who are providing reviews to the pull-requests.
1. On any given pull-request, there only one reviewer should be active at a time. Once the reviewer is done, others may add short comments or any further reviews as needed. Again, one at a time.
2. Assigning reviewers should be avoided unless the pull-request is for a particular task the reviewer is more proficient in.
3. Any contributor who has had their code merged into the repo can provide with reviews as they have gone through the repo standards at least once before. The reviewer will be on a first-come-first serve basis.
4. Most repositories have a check-list in the description for pull-requests. Many times, the contributors are not following them and simply remove the checklist or checkthem without taking the time to review the checklist items. These contributors are almost always copying the code from somewhere. These should be pointed out politely and reviews should be blocked until the contributor updates the basic code structure per the checklist and the repo standards.
5. The reviewers should label every pull-request appropriately - including "invalid" as the case may be.
6. Some pull-requests have existing duplicate code or duplicate pull-requests or sometimes, a novice might create a new pull-request for every new commit. This is a daunting task but one of the responsibility of a reviewer.
7. Discourage creating branches on the repo but rather fork the repo to the respective userspace and contribute from that fork.
8. Some repos - C & C++ - have collaboration with GitPod wherein the code and the contribution can be executed and tested online with relative simplicity. It also contains tools necessary to perform debug and CI checks without installing any tools. Encourage contributors to utilize the feature. Reviewers can test the contributed algorithms online without worrying about forks and branches.
9. There should not be any hurry to merge pull-requests. Since the repos are educational, better to get the contributions right even if it takes a bit longer to review. Encourage patience and develop debugging skills of contributors.
================================================
FILE: audio/CMakeLists.txt
================================================
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
# with full pathname. RELATIVE may makes it easier to extract an executable name
# automatically.
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c )
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
foreach( testsourcefile ${APP_SOURCES} )
# I used a simple string replace, to cut off .cpp.
string( REPLACE ".c" "" testname ${testsourcefile} )
add_executable( ${testname} ${testsourcefile} )
install(TARGETS ${testname} DESTINATION "bin/audio")
endforeach( testsourcefile ${APP_SOURCES} )
================================================
FILE: audio/alaw.c
================================================
/**
* @file
* @author [sunzhenliang](https://github.com/HiSunzhenliang)
* @brief A-law algorithm for encoding and decoding (16bit pcm <=> a-law).
* This is the implementation of [G.711](https://en.wikipedia.org/wiki/G.711)
* in C.
**/
/**
* Linear input code | Compressed code | Linear output code
* ------------------+-----------------+-------------------
* s0000000abcdx | s000abcd | s0000000abcd1
* s0000001abcdx | s001abcd | s0000001abcd1
* s000001abcdxx | s010abcd | s000001abcd10
* s00001abcdxxx | s011abcd | s00001abcd100
* s0001abcdxxxx | s100abcd | s0001abcd1000
* s001abcdxxxxx | s101abcd | s001abcd10000
* s01abcdxxxxxx | s110abcd | s01abcd100000
* s1abcdxxxxxxx | s111abcd | s1abcd1000000
*
* Compressed code: (s | eee | abcd)
**/
#include <assert.h> /// for assert
#include <inttypes.h> /// for appropriate size int types
#include <stdio.h> /// for IO operations
/* length of test inputs */
#define LEN ((size_t)8)
/* input pcm for test */
int16_t pcm[LEN] = {1000, -1000, 1234, 3200, -1314, 0, 32767, -32768};
/* result coded alaw for test */
uint8_t r_coded[LEN] = {250, 122, 230, 156, 97, 213, 170, 42};
/* result decoded for test */
int16_t r_decoded[LEN] = {1008, -1008, 1248, 3264, -1312, 8, 32256, -32256};
/**
* @brief 16bit pcm to 8bit alaw
* @param out unsigned 8bit alaw array
* @param in signed 16bit pcm array
* @param len length of pcm array
* @returns void
*/
void encode(uint8_t *out, int16_t *in, size_t len)
{
uint8_t alaw = 0;
int16_t pcm = 0;
int32_t sign = 0;
int32_t abcd = 0;
int32_t eee = 0;
int32_t mask = 0;
for (size_t i = 0; i < len; i++)
{
pcm = *in++;
/* 0-7 kinds of quantization level from the table above */
eee = 7;
mask = 0x4000; /* 0x4000: '0b0100 0000 0000 0000' */
/* Get sign bit */
sign = (pcm & 0x8000) >> 8;
/* Turn negative pcm to positive */
/* The absolute value of a negative number may be larger than the size
* of the corresponding positive number, so here needs `-pcm -1` after
* taking the opposite number. */
pcm = sign ? (-pcm - 1) : pcm;
/* Get eee and abcd bit */
/* Use mask to locate the first `1` bit and quantization level at the
* same time */
while ((pcm & mask) == 0 && eee > 0)
{
eee--;
mask >>= 1;
}
/* The location of abcd bits is related with quantization level. Check
* the table above to determine how many bits to `>>` to get abcd */
abcd = (pcm >> (eee ? (eee + 3) : 4)) & 0x0f;
/* Put the quantization level number at right bit location to get eee
* bits */
eee <<= 4;
/* Splice results */
alaw = (sign | eee | abcd);
/* The standard specifies that all resulting even bits (LSB
* is even) are inverted before the octet is transmitted. This is to
* provide plenty of 0/1 transitions to facilitate the clock recovery
* process in the PCM receivers. Thus, a silent A-law encoded PCM
* channel has the 8 bit samples coded 0xD5 instead of 0x80 in the
* octets. (Reference from wiki above) */
*out++ = alaw ^ 0xD5;
}
}
/**
* @brief 8bit alaw to 16bit pcm
* @param out signed 16bit pcm array
* @param in unsigned 8bit alaw array
* @param len length of alaw array
* @returns void
*/
void decode(int16_t *out, uint8_t *in, size_t len)
{
uint8_t alaw = 0;
int32_t pcm = 0;
int32_t sign = 0;
int32_t eee = 0;
for (size_t i = 0; i < len; i++)
{
alaw = *in++;
/* Re-toggle toggled bits */
alaw ^= 0xD5;
/* Get sign bit */
sign = alaw & 0x80;
/* Get eee bits */
eee = (alaw & 0x70) >> 4;
/* Get abcd bits and add 1/2 quantization step */
pcm = (alaw & 0x0f) << 4 | 8;
/* If quantization level > 0, there need `1` bit before abcd bits */
pcm += eee ? 0x100 : 0x0;
/* Left shift according quantization level */
pcm <<= eee > 1 ? (eee - 1) : 0;
/* Use the right sign */
*out++ = sign ? -pcm : pcm;
}
}
/**
* @brief Self-test implementations
* @param pcm signed 16bit pcm array
* @param coded unsigned 8bit alaw array
* @param decoded signed 16bit pcm array
* @param len length of test array
* @returns void
*/
static void test(int16_t *pcm, uint8_t *coded, int16_t *decoded, size_t len)
{
/* run encode */
encode(coded, pcm, len);
/* check encode result */
for (size_t i = 0; i < len; i++)
{
assert(coded[i] == r_coded[i]);
}
/* run decode */
decode(decoded, coded, len);
/* check decode result */
for (size_t i = 0; i < len; i++)
{
assert(decoded[i] == r_decoded[i]);
}
}
/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[])
{
/* output alaw encoded by encode() */
uint8_t coded[LEN];
/* output pcm decoded by decode() from coded[LEN] */
int16_t decoded[LEN];
test(pcm, coded, decoded, LEN); // run self-test implementations
/* print test pcm inputs */
printf("inputs: ");
for (size_t i = 0; i < LEN; i++)
{
printf("%d ", pcm[i]);
}
printf("\n");
/* print encoded alaw */
printf("encode: ");
for (size_t i = 0; i < LEN; i++)
{
printf("%u ", coded[i]);
}
printf("\n");
/* print decoded pcm */
printf("decode: ");
for (size_t i = 0; i < LEN; i++)
{
printf("%d ", decoded[i]);
}
printf("\n");
/* It can be seen that the encoded alaw is smaller than the input PCM, so
* the purpose of compression is achieved. And the decoded PCM is almost the
* same as the original input PCM, which verifies the correctness of the
* decoding. The reason why it is not exactly the same is that there is
* precision loss during encode / decode. */
return 0;
}
================================================
FILE: cipher/CMakeLists.txt
================================================
# 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} )
================================================
FILE: cipher/affine.c
================================================
/**
* @file
* @brief An [affine cipher](https://en.wikipedia.org/wiki/Affine_cipher) is a
* letter substitution cipher that uses a linear transformation to substitute
* letters in a message.
* @details Given an alphabet of length M with characters with numeric values
* 0-(M-1), an arbitrary character x can be transformed with the expression (ax
* + b) % M into our ciphertext character. The only caveat is that a must be
* relatively prime with M in order for this transformation to be invertible,
* i.e., gcd(a, M) = 1.
* @author [Daniel Murrow](https://github.com/dsmurrow)
*/
#include <assert.h> /// for assertions
#include <stdio.h> /// for IO
#include <stdlib.h> /// for div function and div_t struct as well as malloc and free
#include <string.h> /// for strlen, strcpy, and strcmp
/**
* @brief number of characters in our alphabet (printable ASCII characters)
*/
#define ALPHABET_SIZE 95
/**
* @brief used to convert a printable byte (32 to 126) to an element of the
* group Z_95 (0 to 94)
*/
#define Z95_CONVERSION_CONSTANT 32
/**
* @brief a structure representing an affine cipher key
*/
typedef struct
{
int a; ///< what the character is being multiplied by
int b; ///< what is being added after the multiplication with `a`
} affine_key_t;
/**
* @brief finds the value x such that (a * x) % m = 1
*
* @param a number we are finding the inverse for
* @param m the modulus the inversion is based on
*
* @returns the modular multiplicative inverse of `a` mod `m`
*/
int modular_multiplicative_inverse(unsigned int a, unsigned int m)
{
int x[2] = {1, 0};
div_t div_result;
if (m == 0) {
return 0;
}
a %= m;
if (a == 0) {
return 0;
}
div_result.rem = a;
while (div_result.rem > 0)
{
div_result = div(m, a);
m = a;
a = div_result.rem;
// Calculate value of x for this iteration
int next = x[1] - (x[0] * div_result.quot);
x[1] = x[0];
x[0] = next;
}
return x[1];
}
/**
* @brief Given a valid affine cipher key, this function will produce the
* inverse key.
*
* @param key They key to be inverted
*
* @returns inverse of key
*/
affine_key_t inverse_key(affine_key_t key)
{
affine_key_t inverse;
inverse.a = modular_multiplicative_inverse(key.a, ALPHABET_SIZE);
// Turn negative results positive
inverse.a += ALPHABET_SIZE;
inverse.a %= ALPHABET_SIZE;
inverse.b = -(key.b % ALPHABET_SIZE) + ALPHABET_SIZE;
return inverse;
}
/**
* @brief Encrypts character string `s` with key
*
* @param s string to be encrypted
* @param key affine key used for encryption
*
* @returns void
*/
void affine_encrypt(char *s, affine_key_t key)
{
for (int i = 0; s[i] != '\0'; i++)
{
int c = (int)s[i] - Z95_CONVERSION_CONSTANT;
c *= key.a;
c += key.b;
c %= ALPHABET_SIZE;
s[i] = (char)(c + Z95_CONVERSION_CONSTANT);
}
}
/**
* @brief Decrypts an affine ciphertext
*
* @param s string to be decrypted
* @param key Key used when s was encrypted
*
* @returns void
*/
void affine_decrypt(char *s, affine_key_t key)
{
affine_key_t inverse = inverse_key(key);
for (int i = 0; s[i] != '\0'; i++)
{
int c = (int)s[i] - Z95_CONVERSION_CONSTANT;
c += inverse.b;
c *= inverse.a;
c %= ALPHABET_SIZE;
s[i] = (char)(c + Z95_CONVERSION_CONSTANT);
}
}
/**
* @brief Tests a given string
*
* @param s string to be tested
* @param a value of key.a
* @param b value of key.b
*
* @returns void
*/
void test_string(const char *s, const char *ciphertext, int a, int b)
{
char *copy = malloc((strlen(s) + 1) * sizeof(char));
strcpy(copy, s);
affine_key_t key = {a, b};
affine_encrypt(copy, key);
assert(strcmp(copy, ciphertext) == 0); // assert that the encryption worked
affine_decrypt(copy, key);
assert(strcmp(copy, s) ==
0); // assert that we got the same string we started with
free(copy);
}
/**
* @brief Test multiple strings
*
* @returns void
*/
static void tests()
{
test_string("Hello!", "&3ddy2", 7, 11);
test_string("TheAlgorithms/C", "DNC}=jHS2zN!7;E", 67, 67);
test_string("0123456789", "840,($ {ws", 91, 88);
test_string("7W@;cdeRT9uL", "JDfa*we?z&bL", 77, 76);
test_string("~Qr%^-+++$leM", "r'qC0$sss;Ahf", 8, 90);
test_string("The quick brown fox jumps over the lazy dog",
"K7: .*6<4 =-0(1 90' 5*2/, 0):- +7: 3>%& ;08", 94, 0);
test_string(
"One-1, Two-2, Three-3, Four-4, Five-5, Six-6, Seven-7, Eight-8, "
"Nine-9, Ten-10",
"H&60>\\2*uY0q\\2*p4660E\\2XYn40x\\2XDB60L\\2VDI0 "
"\\2V6B6&0S\\2%D=p;0'\\2tD&60Z\\2*6&0>j",
51, 18);
printf("All tests have successfully passed!\n");
}
/**
* @brief main function
*
* @returns 0 upon successful program exit
*/
int main()
{
tests();
return 0;
}
================================================
FILE: cipher/rot13.c
================================================
/**
* @file
* @brief [ROT13](https://en.wikipedia.org/wiki/ROT13) is a simple letter
* substitution cipher that replaces a letter with the 13th letter after it in
* the alphabet.
* @details ROT13 transforms a piece of text by examining its alphabetic
* characters and replacing each one with the letter 13 places further along in
* the alphabet, wrapping back to the beginning if necessary. A becomes N, B
* becomes O, and so on up to M, which becomes Z, then the sequence continues at
* the beginning of the alphabet: N becomes A, O becomes B, and so on to Z,
* which becomes M.
* @author [Jeremias Moreira Gomes](https://github.com/j3r3mias)
*/
#include <stdio.h> /// for IO operations
#include <string.h> /// for string operations
#include <assert.h> /// for assert
/**
* @brief Apply the ROT13 cipher
* @param s contains the string to be processed
*/
void rot13(char *s) {
for (int i = 0; s[i]; i++) {
if (s[i] >= 'A' && s[i] <= 'Z') {
s[i] = 'A' + ((s[i] - 'A' + 13) % 26);
} else if (s[i] >= 'a' && s[i] <= 'z') {
s[i] = 'a' + ((s[i] - 'a' + 13) % 26);
}
}
}
/**
* @brief Self-test implementations
* @returns void
*/
static void test() {
char test_01[] = "The more I C, the less I see.";
rot13(test_01);
assert(strcmp(test_01, "Gur zber V P, gur yrff V frr.") == 0);
char test_02[] = "Which witch switched the Swiss wristwatches?";
rot13(test_02);
assert(strcmp(test_02, "Juvpu jvgpu fjvgpurq gur Fjvff jevfgjngpurf?") == 0);
char test_03[] = "Juvpu jvgpu fjvgpurq gur Fjvff jevfgjngpurf?";
rot13(test_03);
assert(strcmp(test_03, "Which witch switched the Swiss wristwatches?") == 0);
printf("All tests have successfully passed!\n");
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
test(); // run self-test implementations
return 0;
}
================================================
FILE: client_server/CMakeLists.txt
================================================
include(CheckIncludeFile)
if(WIN32)
CHECK_INCLUDE_FILE(winsock2.h WINSOCK_HEADER)
else()
CHECK_INCLUDE_FILE(arpa/inet.h ARPA_HEADERS)
endif()
include(CheckSymbolExists)
if(ARPA_HEADERS OR WINSOCK_HEADER)
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
# with full pathname. RELATIVE may makes it easier to extract an executable name
# automatically.
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c )
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
foreach( testsourcefile ${APP_SOURCES} )
# I used a simple string replace, to cut off .cpp.
string(REPLACE ".c" "" testname ${testsourcefile})
if(NOT WIN32)
if(${testname} STREQUAL "fork" OR ${testname} STREQUAL "bool")
continue()
endif()
endif()
add_executable(${testname} ${testsourcefile})
if (OpenMP_C_FOUND)
target_link_libraries(${testname} PRIVATE OpenMP::OpenMP_C)
endif ()
if (MATH_LIBRARY)
target_link_libraries(${testname} PRIVATE ${MATH_LIBRARY})
endif ()
# if(HAS_UNISTD)
# target_compile_definitions(${testname} PRIVATE HAS_UNISTD)
# endif()
# if(ARPA_HEADERS)
# target_compile_definitions(${testname} PRIVATE ARPA_HEADERS)
# else()
# target_compile_definitions(${testname} PRIVATE WINSOCK_HEADER)
# endif()
if (WINSOCK_HEADER)
target_link_libraries(${testname} PRIVATE ws2_32) # link winsock library on windows
endif()
install(TARGETS ${testname} DESTINATION "bin/client_server")
endforeach( testsourcefile ${APP_SOURCES} )
else()
message(WARNING "socket headers not found in system.")
endif(ARPA_HEADERS OR WINSOCK_HEADER)
================================================
FILE: client_server/bool.h
================================================
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007 - INRIA
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* This file was originally licensed under the terms of the CeCILL v2.1,
* and continues to be available under such terms.
* For more information, see the COPYING file which you should have received
* along with this program.
*
*/
#ifndef __BOOL_H__
#define __BOOL_H__
/* define boolean type */
#ifdef BOOL
#undef BOOL
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifdef FALSE
#undef FALSE
#endif
#ifndef _MSC_VER
typedef enum
{
FALSE = 0,
TRUE = 1
} BOOL;
#else
/* Please notice that BOOL is defined in <windef.h> */
/* BUT windef.h includes all others windows include */
/* it is better to redefine as */
typedef int BOOL;
#define FALSE 0
#define TRUE 1
#endif
/* converts BOOL to bool */
#define BOOLtobool(w) ((w != FALSE) ? true : false)
/* converts bool to BOOL */
#define booltoBOOL(w) ((w == true) ? TRUE : FALSE)
#endif /* __BOOL_H__ */
/*--------------------------------------------------------------------------*/
================================================
FILE: client_server/client.c
================================================
/**
* @file
* @author [Nairit11](https://github.com/Nairit11)
* @author [Krishna Vedala](https://github.com/kvedala)
* @brief Client side implementation of Server-Client system.
* @see client_server/server.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32 // if compiling for Windows
#define _WINSOCK_DEPRECATED_NO_WARNINGS // will make the code invalid for next
// MSVC compiler versions
#include <winsock2.h>
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define read(a, b, c) recv(a, b, c, 0) /**< map BSD name to Winsock */
#define write(a, b, c) send(a, b, c, 0) /**< map BSD name to Winsock */
#define close closesocket /**< map BSD name to Winsock */
#else // if not windows platform
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
#define MAX 80 /**< max. characters per message */
#define PORT 8080 /**< port number to connect to */
#define SA struct sockaddr /**< shortname for sockaddr */
/**
* Continuous loop to send and receive over the socket.
* Exits when "exit" is sent from commandline.
* @param sockfd socket handle number
*/
void func(int sockfd)
{
char buff[MAX];
int n;
for (;;)
{
bzero(buff, sizeof(buff));
printf("Enter the string : ");
n = 0;
while ((buff[n++] = getchar()) != '\n')
{
;
}
write(sockfd, buff, sizeof(buff));
bzero(buff, sizeof(buff));
read(sockfd, buff, sizeof(buff));
printf("From Server : %s", buff);
if ((strncmp(buff, "exit", 4)) == 0)
{
printf("Client Exit...\n");
break;
}
}
}
#ifdef _WIN32
/** Cleanup function will be automatically called on program exit */
void cleanup() { WSACleanup(); }
#endif
/**
* @brief Driver code
*/
int main()
{
#ifdef _WIN32
// when using winsock2.h, startup required
WSADATA wsData;
if (WSAStartup(MAKEWORD(2, 2), &wsData) != 0)
{
perror("WSA Startup error: \n");
return 0;
}
atexit(cleanup); // register at-exit function
#endif
int sockfd, connfd;
struct sockaddr_in servaddr, cli;
// socket create and verification
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == -1)
{
printf("socket creation failed...\n");
exit(0);
}
else
{
printf("Socket successfully created..\n");
}
bzero(&servaddr, sizeof(servaddr));
// assign IP, PORT
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
servaddr.sin_port = htons(PORT);
// connect the client socket to server socket
if (connect(sockfd, (SA *)&servaddr, sizeof(servaddr)) != 0)
{
printf("connection with the server failed...\n");
exit(0);
}
else
{
printf("connected to the server..\n");
}
// function for chat
func(sockfd);
// close the socket
close(sockfd);
return 0;
}
================================================
FILE: client_server/fork.h
================================================
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) DIGITEO - 2010 - Allan CORNET
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* This file was originally licensed under the terms of the CeCILL v2.1,
* and continues to be available under such terms.
* For more information, see the COPYING file which you should have received
* along with this program.
*
*/
/*--------------------------------------------------------------------------*/
#ifndef __FORK_H__
#define __FORK_H__
/* http://technet.microsoft.com/en-us/library/bb497007.aspx */
/* http://undocumented.ntinternals.net/ */
#include <setjmp.h>
#include <windows.h>
#include "bool.h"
/**
* simulate fork on Windows
*/
int fork(void);
/**
* check if symbols to simulate fork are present
* and load these symbols
*/
BOOL haveLoadedFunctionsForFork(void);
/*--------------------------------------------------------------------------*/
typedef LONG NTSTATUS;
/*--------------------------------------------------------------------------*/
typedef struct _SYSTEM_HANDLE_INFORMATION
{
ULONG ProcessId;
UCHAR ObjectTypeNumber;
UCHAR Flags;
USHORT Handle;
PVOID Object;
ACCESS_MASK GrantedAccess;
} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
/*--------------------------------------------------------------------------*/
typedef struct _OBJECT_ATTRIBUTES
{
ULONG Length;
HANDLE RootDirectory;
PVOID /* really PUNICODE_STRING */ ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
/*--------------------------------------------------------------------------*/
typedef enum _MEMORY_INFORMATION_
{
MemoryBasicInformation,
MemoryWorkingSetList,
MemorySectionName,
MemoryBasicVlmInformation
} MEMORY_INFORMATION_CLASS;
/*--------------------------------------------------------------------------*/
typedef struct _CLIENT_ID
{
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
/*--------------------------------------------------------------------------*/
typedef struct _USER_STACK
{
PVOID FixedStackBase;
PVOID FixedStackLimit;
PVOID ExpandableStackBase;
PVOID ExpandableStackLimit;
PVOID ExpandableStackBottom;
} USER_STACK, *PUSER_STACK;
/*--------------------------------------------------------------------------*/
typedef LONG KPRIORITY;
typedef ULONG_PTR KAFFINITY;
typedef KAFFINITY *PKAFFINITY;
/*--------------------------------------------------------------------------*/
typedef struct _THREAD_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PVOID TebBaseAddress;
CLIENT_ID ClientId;
KAFFINITY AffinityMask;
KPRIORITY Priority;
KPRIORITY BasePriority;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
/*--------------------------------------------------------------------------*/
typedef enum _SYSTEM_INFORMATION_CLASS
{
SystemHandleInformation = 0x10
} SYSTEM_INFORMATION_CLASS;
/*--------------------------------------------------------------------------*/
typedef NTSTATUS(NTAPI *ZwWriteVirtualMemory_t)(
IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN PVOID Buffer,
IN ULONG NumberOfBytesToWrite, OUT PULONG NumberOfBytesWritten OPTIONAL);
/*--------------------------------------------------------------------------*/
typedef NTSTATUS(NTAPI *ZwCreateProcess_t)(
OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE InheriteFromProcessHandle,
IN BOOLEAN InheritHandles, IN HANDLE SectionHandle OPTIONAL,
IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL);
/*--------------------------------------------------------------------------*/
typedef NTSTATUS(WINAPI *ZwQuerySystemInformation_t)(
SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation,
ULONG SystemInformationLength, PULONG ReturnLength);
typedef NTSTATUS(NTAPI *ZwQueryVirtualMemory_t)(
IN HANDLE ProcessHandle, IN PVOID BaseAddress,
IN MEMORY_INFORMATION_CLASS MemoryInformationClass,
OUT PVOID MemoryInformation, IN ULONG MemoryInformationLength,
OUT PULONG ReturnLength OPTIONAL);
/*--------------------------------------------------------------------------*/
typedef NTSTATUS(NTAPI *ZwGetContextThread_t)(IN HANDLE ThreadHandle,
OUT PCONTEXT Context);
typedef NTSTATUS(NTAPI *ZwCreateThread_t)(
OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle,
OUT PCLIENT_ID ClientId, IN PCONTEXT ThreadContext,
IN PUSER_STACK UserStack, IN BOOLEAN CreateSuspended);
/*--------------------------------------------------------------------------*/
typedef NTSTATUS(NTAPI *ZwResumeThread_t)(IN HANDLE ThreadHandle,
OUT PULONG SuspendCount OPTIONAL);
typedef NTSTATUS(NTAPI *ZwClose_t)(IN HANDLE ObjectHandle);
typedef NTSTATUS(NTAPI *ZwQueryInformationThread_t)(
IN HANDLE ThreadHandle, IN THREAD_INFORMATION_CLASS ThreadInformationClass,
OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength,
OUT PULONG ReturnLength OPTIONAL);
/*--------------------------------------------------------------------------*/
static ZwCreateProcess_t ZwCreateProcess = NULL;
static ZwQuerySystemInformation_t ZwQuerySystemInformation = NULL;
static ZwQueryVirtualMemory_t ZwQueryVirtualMemory = NULL;
static ZwCreateThread_t ZwCreateThread = NULL;
static ZwGetContextThread_t ZwGetContextThread = NULL;
static ZwResumeThread_t ZwResumeThread = NULL;
static ZwClose_t ZwClose = NULL;
static ZwQueryInformationThread_t ZwQueryInformationThread = NULL;
static ZwWriteVirtualMemory_t ZwWriteVirtualMemory = NULL;
/*--------------------------------------------------------------------------*/
#define NtCurrentProcess() ((HANDLE)-1)
#define NtCurrentThread() ((HANDLE)-2)
/* we use really the Nt versions - so the following is just for completeness */
#define ZwCurrentProcess() NtCurrentProcess()
#define ZwCurrentThread() NtCurrentThread()
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
/*--------------------------------------------------------------------------*/
/* setjmp env for the jump back into the fork() function */
static jmp_buf jenv;
/*--------------------------------------------------------------------------*/
/* entry point for our child thread process - just longjmp into fork */
static int child_entry(void)
{
longjmp(jenv, 1);
return 0;
}
/*--------------------------------------------------------------------------*/
static BOOL haveLoadedFunctionsForFork(void)
{
HMODULE ntdll = GetModuleHandle("ntdll");
if (ntdll == NULL)
{
return FALSE;
}
if (ZwCreateProcess && ZwQuerySystemInformation && ZwQueryVirtualMemory &&
ZwCreateThread && ZwGetContextThread && ZwResumeThread &&
ZwQueryInformationThread && ZwWriteVirtualMemory && ZwClose)
{
return TRUE;
}
ZwCreateProcess =
(ZwCreateProcess_t)GetProcAddress(ntdll, "ZwCreateProcess");
ZwQuerySystemInformation = (ZwQuerySystemInformation_t)GetProcAddress(
ntdll, "ZwQuerySystemInformation");
ZwQueryVirtualMemory =
(ZwQueryVirtualMemory_t)GetProcAddress(ntdll, "ZwQueryVirtualMemory");
ZwCreateThread = (ZwCreateThread_t)GetProcAddress(ntdll, "ZwCreateThread");
ZwGetContextThread =
(ZwGetContextThread_t)GetProcAddress(ntdll, "ZwGetContextThread");
ZwResumeThread = (ZwResumeThread_t)GetProcAddress(ntdll, "ZwResumeThread");
ZwQueryInformationThread = (ZwQueryInformationThread_t)GetProcAddress(
ntdll, "ZwQueryInformationThread");
ZwWriteVirtualMemory =
(ZwWriteVirtualMemory_t)GetProcAddress(ntdll, "ZwWriteVirtualMemory");
ZwClose = (ZwClose_t)GetProcAddress(ntdll, "ZwClose");
if (ZwCreateProcess && ZwQuerySystemInformation && ZwQueryVirtualMemory &&
ZwCreateThread && ZwGetContextThread && ZwResumeThread &&
ZwQueryInformationThread && ZwWriteVirtualMemory && ZwClose)
{
return TRUE;
}
else
{
ZwCreateProcess = NULL;
ZwQuerySystemInformation = NULL;
ZwQueryVirtualMemory = NULL;
ZwCreateThread = NULL;
ZwGetContextThread = NULL;
ZwResumeThread = NULL;
ZwQueryInformationThread = NULL;
ZwWriteVirtualMemory = NULL;
ZwClose = NULL;
}
return FALSE;
}
/*--------------------------------------------------------------------------*/
int fork(void)
{
HANDLE hProcess = 0, hThread = 0;
OBJECT_ATTRIBUTES oa = {sizeof(oa)};
MEMORY_BASIC_INFORMATION mbi;
CLIENT_ID cid;
USER_STACK stack;
PNT_TIB tib;
THREAD_BASIC_INFORMATION tbi;
CONTEXT context = {CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS |
CONTEXT_FLOATING_POINT};
if (setjmp(jenv) != 0)
{
return 0; /* return as a child */
}
/* check whether the entry points are initilized and get them if necessary
*/
if (!ZwCreateProcess && !haveLoadedFunctionsForFork())
{
return -1;
}
/* create forked process */
ZwCreateProcess(&hProcess, PROCESS_ALL_ACCESS, &oa, NtCurrentProcess(),
TRUE, 0, 0, 0);
/* set the Eip for the child process to our child function */
ZwGetContextThread(NtCurrentThread(), &context);
/* In x64 the Eip and Esp are not present, their x64 counterparts are Rip
and Rsp respectively.
*/
#if _WIN64
context.Rip = (ULONG)child_entry;
#else
context.Eip = (ULONG)child_entry;
#endif
#if _WIN64
ZwQueryVirtualMemory(NtCurrentProcess(), (PVOID)context.Rsp,
MemoryBasicInformation, &mbi, sizeof mbi, 0);
#else
ZwQueryVirtualMemory(NtCurrentProcess(), (PVOID)context.Esp,
MemoryBasicInformation, &mbi, sizeof mbi, 0);
#endif
stack.FixedStackBase = 0;
stack.FixedStackLimit = 0;
stack.ExpandableStackBase = (PCHAR)mbi.BaseAddress + mbi.RegionSize;
stack.ExpandableStackLimit = mbi.BaseAddress;
stack.ExpandableStackBottom = mbi.AllocationBase;
/* create thread using the modified context and stack */
ZwCreateThread(&hThread, THREAD_ALL_ACCESS, &oa, hProcess, &cid, &context,
&stack, TRUE);
/* copy exception table */
ZwQueryInformationThread(NtCurrentThread(), ThreadMemoryPriority, &tbi,
sizeof tbi, 0);
tib = (PNT_TIB)tbi.TebBaseAddress;
ZwQueryInformationThread(hThread, ThreadMemoryPriority, &tbi, sizeof tbi,
0);
ZwWriteVirtualMemory(hProcess, tbi.TebBaseAddress, &tib->ExceptionList,
sizeof tib->ExceptionList, 0);
/* start (resume really) the child */
ZwResumeThread(hThread, 0);
/* clean up */
ZwClose(hThread);
ZwClose(hProcess);
/* exit with child's pid */
return (int)cid.UniqueProcess;
}
#endif /* __FORK_H__ */
/*--------------------------------------------------------------------------*/
================================================
FILE: client_server/remote_command_exec_udp_client.c
================================================
/**
* @file
* @author [NVombat](https://github.com/NVombat)
* @brief Client-side implementation of [Remote Command
* Execution Using
* UDP](https://www.imperva.com/learn/ddos/udp-user-datagram-protocol/)
* @see remote_command_exec_udp_server.c
*
* @details
* The algorithm is based on the simple UDP client and server model. It
* runs an infinite loop which takes user input and sends it to the server
* for execution. The server receives the commands and executes them
* until the user exits the loop. In this way, Remote Command Execution
* using UDP is shown using the server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define close _close
#include <Ws2tcpip.h>
#include <io.h>
#include <winsock2.h> /// For the type in_addr_t and in_port_t
#else
#include <arpa/inet.h> /// For the type in_addr_t and in_port_t
#include <netdb.h> /// For structures returned by the network database library - formatted internet addresses and port numbers
#include <netinet/in.h> /// For in_addr and sockaddr_in structures
#include <sys/socket.h> /// For macro definitions related to the creation of sockets
#include <sys/types.h> /// For definitions to allow for the porting of BSD programs
#include <unistd.h>
#endif
#include <errno.h> /// To indicate what went wrong if an error occurs
#include <stdint.h> /// For specific bit size values of variables
#include <stdio.h> /// Variable types, several macros, and various functions for performing input and output
#include <stdlib.h> /// Variable types, several macros, and various functions for performing general functions
#include <string.h> /// Various functions for manipulating arrays of characters
#define PORT 10000 /// Define port over which communication will take place
/**
* @brief Utility function used to print an error message to `stderr`.
* It prints `str` and an implementation-defined error
* message corresponding to the global variable `errno`.
* @returns void
*/
void error()
{
perror("Socket Creation Failed");
exit(EXIT_FAILURE);
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main()
{
/** Variable Declarations */
uint32_t
sockfd; ///< socket descriptors - Like file handles but for sockets
char send_msg[1024],
recv_msg[1024]; ///< character arrays to read and store string data
/// for communication
struct sockaddr_in
server_addr; ///< basic structures for all syscalls and functions that
/// deal with internet addresses. Structures for handling
/// internet addresses
socklen_t serverLength = sizeof(server_addr); ///< length of socket
/**
* The UDP socket is created using the socket function.
*
* AF_INET (Family) - it is an address family that is used to designate the
* type of addresses that your socket can communicate with
*
* SOCK_DGRAM (Type) - Indicates UDP Connection - UDP does not require the
* source and destination to establish a three-way handshake before
* transmission takes place. Additionally, there is no need for an
* end-to-end connection
*
* 0 (Protocol) - Specifies a particular protocol to be used with the
* socket. Specifying a protocol of 0 causes socket() to use an unspecified
* default protocol appropriate for the requested socket type.
*/
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
error();
}
/**
* Server Address Information
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area.
*
* We bind the server_addr to the internet address and port number thus
* giving our socket an identity with an address and port where it can
* listen for connections
*
* htons - The htons() function translates a short integer from host byte
* order to network byte order
*
* htonl - The htonl() function translates a long integer from host byte
* order to network byte order
*
* These functions are necessary so that the binding of address and port
* takes place with data in the correct format
*/
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(PORT);
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
printf("Client is running...\n");
/**
* Connects the client to the server address using the socket descriptor
* This enables the two to communicate and exchange data
*/
connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr));
printf("Client is Connected Successfully...\n");
/**
* Communication between client and server
*
* The client sends data to the server after taking the input
* from the user
*
* The client then receives a response from the server when the
* command has been executed
*
* The server and client can communicate indefinitely till one of them
* exits the connection
*
* The client sends the server a command which it executes thus showing
* remote command execution using UDP
*/
while (1)
{
printf("\nEnter Command To Be Executed Remotely: \n");
fgets(send_msg, sizeof(send_msg), stdin);
sendto(sockfd, send_msg, sizeof(send_msg), 0,
(struct sockaddr *)&server_addr, serverLength);
recvfrom(sockfd, recv_msg, sizeof(recv_msg), 0,
(struct sockaddr *)&server_addr, &serverLength);
printf("Server Reply: %s\n", recv_msg);
}
/// Close Socket
close(sockfd);
printf("Client is offline...\n");
return 0;
}
================================================
FILE: client_server/remote_command_exec_udp_server.c
================================================
/**
* @file
* @author [NVombat](https://github.com/NVombat)
* @brief Server-side implementation of [Remote Command
* Execution Using
* UDP](https://www.imperva.com/learn/ddos/udp-user-datagram-protocol/)
* @see remote_command_exec_udp_server.c
*
* @details
* The algorithm is based on the simple UDP client and server model. It
* runs an infinite loop which takes user input and sends it to the server
* for execution. The server receives the commands and executes them
* until the user exits the loop. In this way, Remote Command Execution
* using UDP is shown using the server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define close _close
#include <Ws2tcpip.h>
#include <io.h>
#include <winsock2.h> /// For the type in_addr_t and in_port_t
#else
#include <arpa/inet.h> /// For the type in_addr_t and in_port_t
#include <netdb.h> /// For structures returned by the network database library - formatted internet addresses and port numbers
#include <netinet/in.h> /// For in_addr and sockaddr_in structures
#include <sys/socket.h> /// For macro definitions related to the creation of sockets
#include <sys/types.h> /// For definitions to allow for the porting of BSD programs
#include <unistd.h>
#endif
#include <errno.h> /// To indicate what went wrong if an error occurs
#include <stdint.h> /// For specific bit size values of variables
#include <stdio.h> /// Variable types, several macros, and various functions for performing input and output
#include <stdlib.h> /// Variable types, several macros, and various functions for performing general functions
#include <string.h> /// Various functions for manipulating arrays of characters
#define PORT 10000 /// Define port over which communication will take place
/**
* @brief Utility function used to print an error message to `stderr`.
* It prints `str` and an implementation-defined error
* message corresponding to the global variable `errno`.
* @returns void
*/
void error()
{
perror("Socket Creation Failed");
exit(EXIT_FAILURE);
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main()
{
/** Variable Declarations */
uint32_t
sockfd; ///< socket descriptors - Like file handles but for sockets
char recv_msg[1024],
success_message[] =
"Command Executed Successfully!\n"; ///< character arrays to read
/// and store string data
/// for communication & Success
/// message
struct sockaddr_in server_addr,
client_addr; ///< basic structures for all syscalls and functions that
/// deal with internet addresses. Structures for handling
/// internet addresses
socklen_t clientLength = sizeof(client_addr); /// size of address
/**
* The UDP socket is created using the socket function.
*
* AF_INET (Family) - it is an address family that is used to designate the
* type of addresses that your socket can communicate with
*
* SOCK_DGRAM (Type) - Indicates UDP Connection - UDP does not require the
* source and destination to establish a three-way handshake before
* transmission takes place. Additionally, there is no need for an
* end-to-end connection
*
* 0 (Protocol) - Specifies a particular protocol to be used with the
* socket. Specifying a protocol of 0 causes socket() to use an unspecified
* default protocol appropriate for the requested socket type.
*/
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
error();
}
/**
* Server Address Information
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area.
*
* We bind the server_addr to the internet address and port number thus
* giving our socket an identity with an address and port where it can
* listen for connections
*
* htons - The htons() function translates a short integer from host byte
* order to network byte order
*
* htonl - The htonl() function translates a long integer from host byte
* order to network byte order
*
* These functions are necessary so that the binding of address and port
* takes place with data in the correct format
*/
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(PORT);
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
/**
* This binds the socket descriptor to the server thus enabling the server
* to listen for connections and communicate with other clients
*/
if (bind(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
{
error(); /// If binding is unsuccessful
}
printf("Server is Connected Successfully...\n");
/**
* Communication between client and server
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area. The variables are emptied and then
* ready for use
*
* The server receives data from the client which is a command. It then
* executes the command.
*
* The client then receives a response from the server when the
* command has been executed
*
* The server and client can communicate indefinitely till one of them
* exits the connection
*
* The client sends the server a command which it executes thus showing
* remote command execution using UDP
*/
while (1)
{
bzero(recv_msg, sizeof(recv_msg));
recvfrom(sockfd, recv_msg, sizeof(recv_msg), 0,
(struct sockaddr *)&client_addr, &clientLength);
printf("Command Output: \n");
system(recv_msg);
printf("Command Executed\n");
sendto(sockfd, success_message, sizeof(success_message), 0,
(struct sockaddr *)&client_addr, clientLength);
}
/// Close socket
close(sockfd);
printf("Server is offline...\n");
return 0;
}
================================================
FILE: client_server/server.c
================================================
/**
* @file
* @author [Nairit11](https://github.com/Nairit11)
* @author [Krishna Vedala](https://github.com/kvedala)
* @brief Server side implementation of Server-Client system.
* @see client_server/client.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #ifdef HAS_UNISTD
// #include <unistd.h>
// #endif
#ifdef _WIN32
#define _WINSOCK_DEPRECATED_NO_WARNINGS // will make the code invalid for next
// MSVC compiler versions
#include <winsock2.h>
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define read(a, b, c) recv(a, b, c, 0) /**< map BSD name to Winsock */
#define write(a, b, c) send(a, b, c, 0) /**< map BSD name to Winsock */
#define close closesocket /**< map BSD name to Winsock */
#else
// if not windows platform
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
#define MAX 80 /**< max. characters per message */
#define PORT 8080 /**< port number to connect to */
#define SA struct sockaddr /**< shortname for sockaddr */
#ifdef _WIN32
/** Cleanup function will be automatically called on program exit */
void cleanup() { WSACleanup(); }
#endif
/**
* Continuous loop to send and receive over the socket.
* Exits when "exit" is sent from commandline.
* @param sockfd socket handle number
*/
void func(int sockfd)
{
char buff[MAX];
int n;
// infinite loop for chat
for (;;)
{
bzero(buff, MAX);
// read the message from client and copy it in buffer
read(sockfd, buff, sizeof(buff));
// print buffer which contains the client contents
printf("From client: %s\t To client : ", buff);
bzero(buff, MAX);
n = 0;
// copy server message in the buffer
while ((buff[n++] = getchar()) != '\n')
{
;
}
// and send that buffer to client
write(sockfd, buff, sizeof(buff));
// if msg contains "Exit" then server exit and chat ended.
if (strncmp("exit", buff, 4) == 0)
{
printf("Server Exit...\n");
break;
}
}
}
/** Driver code */
int main()
{
#ifdef _WIN32
// when using winsock2.h, startup required
WSADATA wsData;
if (WSAStartup(MAKEWORD(2, 2), &wsData) != 0)
{
perror("WSA Startup error: \n");
return 0;
}
atexit(cleanup); // register at-exit function
#endif
int sockfd, connfd;
unsigned int len;
struct sockaddr_in servaddr, cli;
// socket create and verification
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == -1)
{
perror("socket creation failed...\n");
exit(0);
}
else
{
printf("Socket successfully created..\n");
}
bzero(&servaddr, sizeof(servaddr));
// assign IP, PORT
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(PORT);
// Binding newly created socket to given IP and verification
if ((bind(sockfd, (SA *)&servaddr, sizeof(servaddr))) != 0)
{
perror("socket bind failed...\n");
exit(0);
}
else
{
printf("Socket successfully binded..\n");
}
// Now server is ready to listen and verification
if ((listen(sockfd, 5)) != 0)
{
perror("Listen failed...\n");
exit(0);
}
else
{
printf("Server listening..\n");
}
len = sizeof(cli);
// Accept the data packet from client and verification
connfd = accept(sockfd, (SA *)&cli, &len);
if (connfd < 0)
{
perror("server acccept failed...\n");
exit(0);
}
else
{
printf("server acccept the client...\n");
}
// Function for chatting between client and server
func(connfd);
// After chatting close the socket
close(sockfd);
return 0;
}
================================================
FILE: client_server/tcp_full_duplex_client.c
================================================
/**
* @file
* @author [NVombat](https://github.com/NVombat)
* @brief Client-side implementation of [TCP Full Duplex
* Communication](http://www.tcpipguide.com/free/t_SimplexFullDuplexandHalfDuplexOperation.htm)
* @see tcp_full_duplex_server.c
*
* @details
* The algorithm is based on the simple TCP client and server model. However,
* instead of the server only sending and the client only receiving data,
* The server and client can both send and receive data simultaneously. This is
* implemented by using the `fork` function call so that in the server the child
* process can receive data and parent process can send data, and in the client
* the child process can send data and the parent process can receive data. It
* runs an infinite loop and can send and receive messages indefinitely until
* the user exits the loop. In this way, the Full Duplex Form of communication
* can be represented using the TCP server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define pid_t int
#define close _close
#include <Ws2tcpip.h>
#include <io.h>
#include <windows.h>
#include <winsock2.h>
#include "fork.h"
#define sleep(a) Sleep(a * 1000)
#else
#include <arpa/inet.h> /// For the type in_addr_t and in_port_t
#include <netdb.h> /// For structures returned by the network database library - formatted internet addresses and port numbers
#include <netinet/in.h> /// For in_addr and sockaddr_in structures
#include <sys/socket.h> /// For macro definitions related to the creation of sockets
#include <sys/types.h> /// For definitions to allow for the porting of BSD programs
#include <unistd.h>
#endif
#include <stdint.h> /// For specific bit size values of variables
#include <stdio.h> /// Variable types, several macros, and various functions for performing input and output
#include <stdlib.h> /// Variable types, several macros, and various functions for performing general functions
#include <string.h> /// Various functions for manipulating arrays of characters
#define PORT 10000 /// Define port over which communication will take place
/**
* @brief Utility function used to print an error message to `stderr`.
* It prints `str` and an implementation-defined error
* message corresponding to the global variable `errno`.
* @returns void
*/
void error()
{
perror("Socket Creation Failed");
exit(EXIT_FAILURE);
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main()
{
/** Variable Declarations */
uint32_t
sockfd; ///< socket descriptors - Like file handles but for sockets
char sendbuff[1024],
recvbuff[1024]; ///< character arrays to read and store string data
/// for communication
struct sockaddr_in
server_addr; ///< basic structures for all syscalls and functions that
/// deal with internet addresses. Structures for handling
/// internet addresses
/**
* The TCP socket is created using the socket function.
*
* AF_INET (Family) - it is an address family that is used to designate the
* type of addresses that your socket can communicate with
*
* SOCK_STREAM (Type) - Indicates TCP Connection - A stream socket provides
* for the bidirectional, reliable, sequenced, and unduplicated flow of data
* without record boundaries. Aside from the bidirectionality of data flow,
* a pair of connected stream sockets provides an interface nearly identical
* to pipes.
*
* 0 (Protocol) - Specifies a particular protocol to be used with the
* socket. Specifying a protocol of 0 causes socket() to use an unspecified
* default protocol appropriate for the requested socket type.
*/
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
error();
}
/**
* Server Address Information
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area.
*
* We bind the server_addr to the internet address and port number thus
* giving our socket an identity with an address and port where it can
* listen for connections
*
* htons - The htons() function translates a short integer from host byte
* order to network byte order
*
* htonl - The htonl() function translates a long integer from host byte
* order to network byte order
*
* These functions are necessary so that the binding of address and port
* takes place with data in the correct format
*/
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(PORT);
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
printf("Client is running...\n");
/**
* Connects the client to the server address using the socket descriptor
* This enables the two to communicate and exchange data
*/
connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr));
printf("Client is connected...\n");
/**
* Communication between client and server
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area. The variables are emptied and then
* ready for use
*
* The fork function call is used to create a child and parent process
* which run and execute code simultaneously
*
* The child process is used to send data and after doing so
* sleeps for 5 seconds to wait for the parent to receive data
*
* The parent process is used to receive data and after doing so
* sleeps for 5 seconds to wait for the child to send data
*
* The server and client can communicate indefinitely till one of them
* exits the connection
*
* Since the exchange of information between the server and client takes
* place simultaneously this represents FULL DUPLEX COMMUNICATION
*/
pid_t pid;
pid = fork();
if (pid == 0) /// Value of 0 is for child process
{
while (1)
{
bzero(&sendbuff, sizeof(sendbuff));
printf("\nType message here: ");
fgets(sendbuff, 1024, stdin);
send(sockfd, sendbuff, strlen(sendbuff) + 1, 0);
printf("\nMessage sent!\n");
sleep(5);
// break;
}
}
else /// Parent Process
{
while (1)
{
bzero(&recvbuff, sizeof(recvbuff));
recv(sockfd, recvbuff, sizeof(recvbuff), 0);
printf("\nSERVER: %s\n", recvbuff);
sleep(5);
// break;
}
}
/// Close Socket
close(sockfd);
printf("Client is offline...\n");
return 0;
}
================================================
FILE: client_server/tcp_full_duplex_server.c
================================================
/**
* @file
* @author [NVombat](https://github.com/NVombat)
* @brief Server-side implementation of [TCP Full Duplex
* Communication](http://www.tcpipguide.com/free/t_SimplexFullDuplexandHalfDuplexOperation.htm)
* @see tcp_full_duplex_client.c
*
* @details
* The algorithm is based on the simple TCP client and server model. However,
* instead of the server only sending and the client only receiving data,
* The server and client can both send and receive data simultaneously. This is
* implemented by using the `fork` function call so that in the server the child
* process can receive data and parent process can send data, and in the client
* the child process can send data and the parent process can receive data. It
* runs an infinite loop and can send and receive messages indefinitely until
* the user exits the loop. In this way, the Full Duplex Form of communication
* can be represented using the TCP server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define pid_t int
#define close _close
#include <Ws2tcpip.h>
#include <io.h>
#include <windows.h>
#include <winsock2.h>
#include "fork.h"
#define sleep(a) Sleep(a * 1000)
#else
#include <arpa/inet.h> /// For the type in_addr_t and in_port_t
#include <netdb.h> /// For structures returned by the network database library - formatted internet addresses and port numbers
#include <netinet/in.h> /// For in_addr and sockaddr_in structures
#include <sys/socket.h> /// For macro definitions related to the creation of sockets
#include <sys/types.h> /// For definitions to allow for the porting of BSD programs
#include <unistd.h>
#endif
#include <stdint.h> /// For specific bit size values of variables
#include <stdio.h> /// Variable types, several macros, and various functions for performing input and output
#include <stdlib.h> /// Variable types, several macros, and various functions for performing general functions
#include <string.h> /// Various functions for manipulating arrays of characters
#define PORT 10000 /// Define port over which communication will take place
/**
* @brief Utility function used to print an error message to `stderr`.
* It prints `str` and an implementation-defined error
* message corresponding to the global variable `errno`.
* @returns void
*/
void error()
{
perror("Socket Creation Failed");
exit(EXIT_FAILURE);
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main()
{
/** Variable Declarations */
uint32_t sockfd,
conn; ///< socket descriptors - Like file handles but for sockets
char recvbuff[1024],
sendbuff[1024]; ///< character arrays to read and store string data
/// for communication
struct sockaddr_in server_addr,
client_addr; ///< basic structures for all syscalls and functions that
/// deal with internet addresses. Structures for handling
/// internet addresses
socklen_t ClientLen; /// size of address
/**
* The TCP socket is created using the socket function
*
* AF_INET (Family) - it is an address family that is used to designate the
* type of addresses that your socket can communicate with
*
* SOCK_STREAM (Type) - Indicates TCP Connection - A stream socket provides
* for the bidirectional, reliable, sequenced, and unduplicated flow of data
* without record boundaries. Aside from the bidirectionality of data flow,
* a pair of connected stream sockets provides an interface nearly identical
* to pipes
*
* 0 (Protocol) - Specifies a particular protocol to be used with the
* socket. Specifying a protocol of 0 causes socket() to use an unspecified
* default protocol appropriate for the requested socket type
*/
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
error(); ///< Error if the socket descriptor has a value lower than 0 -
/// socket wasnt created
}
/**
* Server Address Information
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area
*
* We bind the server_addr to the internet address and port number thus
* giving our socket an identity with an address and port where it can
* listen for connections
*
* htons - The htons() function translates a short integer from host byte
* order to network byte order
*
* htonl - The htonl() function translates a long integer from host byte
* order to network byte order
*
* These functions are necessary so that the binding of address and port
* takes place with data in the correct format
*/
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(PORT);
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
printf("Server is running...\n");
/**
* This binds the socket descriptor to the server thus enabling the server
* to listen for connections and communicate with other clients
*/
if (bind(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
{
error(); /// If binding is unsuccessful
}
/**
* This is to listen for clients or connections made to the server
*
* The limit is currently at 5 but can be increased to listen for
* more connections
*
* It listens to connections through the socket descriptor
*/
listen(sockfd, 5);
printf("Server is listening...\n");
/**
* When a connection is found, a socket is created and connection is
* accepted and established through the socket descriptor
*/
conn = accept(sockfd, (struct sockaddr *)NULL, NULL);
printf("Server is connected...\n");
/**
* Communication between client and server
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area. The variables are emptied and then
* ready for use
*
* The fork function call is used to create a child and parent process
* which run and execute code simultaneously
*
* The child process is used to receive data and after doing so
* sleeps for 5 seconds to wait for the parent to send data
*
* The parent process is used to send data and after doing so
* sleeps for 5 seconds to wait for the child to receive data
*
* The server and client can communicate indefinitely till one of them
* exits the connection
*
* Since the exchange of information between the server and client takes
* place simultaneously this represents FULL DUPLEX COMMUNICATION
*/
pid_t pid;
#ifdef _WIN32
#ifdef FORK_WINDOWS
pid = fork();
#endif
#else
pid = fork();
#endif
if (pid == 0) /// Value of 0 is for child process
{
while (1)
{
bzero(&recvbuff, sizeof(recvbuff));
recv(conn, recvbuff, sizeof(recvbuff), 0);
printf("\nCLIENT : %s\n", recvbuff);
sleep(5);
// break;
}
}
else /// Parent process
{
while (1)
{
bzero(&sendbuff, sizeof(sendbuff));
printf("\nType message here: ");
fgets(sendbuff, 1024, stdin);
send(conn, sendbuff, strlen(sendbuff) + 1, 0);
printf("\nMessage Sent!\n");
sleep(5);
// break;
}
}
/// Close socket
close(sockfd);
printf("Server is offline...\n");
return 0;
}
================================================
FILE: client_server/tcp_half_duplex_client.c
================================================
/**
* @file
* @author [Nikhill Vombatkere](https://github.com/NVombat)
* @brief Client-side implementation of [TCP Half Duplex
* Communication](http://www.tcpipguide.com/free/t_SimplexFullDuplexandHalfDuplexOperation.htm)
* @see tcp_half_duplex_server.c
*
* @details
* The algorithm is based on the simple TCP client and server model. However,
* instead of the server only sending and the client only receiving data,
* the server and client can both send data but only one at a time. This is
* implemented by using a particular ordering of the `send()` and `recv()`
* functions. When one of the clients or servers is sending, the other can only
* receive and vice-versa. In this way, the Half Duplex Form of communication
* can be represented using the TCP server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
(memset((b), '\0', (len)), (void)0) /**< BSD name not in windows */
#define close _close
#include <Ws2tcpip.h>
#include <io.h>
#include <winsock2.h>
#else
#include <netdb.h> /// For structures returned by the network database library - formatted internet addresses and port numbers
#include <sys/socket.h> /// For macro definitions related to the creation of sockets
#include <sys/types.h> /// For definitions to allow for the porting of BSD programs
#include <unistd.h>
#endif
// #include <netinet/in.h> /// For in_addr and sockaddr_in structures
#include <stdint.h> /// For specific bit size values of variables
#include <stdio.h> /// Variable types, several macros, and various functions for performing input and output
#include <stdlib.h> /// Variable types, several macros, and various functions for performing general functions
#include <string.h> /// Various functions for manipulating arrays of characters
#define PORT 8100 /// Define port over which communication will take place
/**
* @brief Utility function used to print an error message to `stderr`.
* It prints `str` and an implementation-defined error
* message corresponding to the global variable `errno`.
* @returns void
*/
void error()
{
perror("Socket Creation Failed");
exit(EXIT_FAILURE);
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main()
{
/** Variable Declarations */
uint32_t
sockfd; ///< socket descriptors - Like file handles but for sockets
struct sockaddr_in
server_addr; ///< basic structures for all syscalls and functions that
/// deal with internet addresses. Structures for handling
/// internet addresses
char serverResponse[10000],
clientResponse[10000]; ///< Character arrays to read and store string
/// data for communication
/**
* The TCP socket is created using the socket function.
*
* AF_INET (Family) - it is an address family that is used to designate the
* type of addresses that your socket can communicate with
*
* SOCK_STREAM (Type) - Indicates TCP Connection - A stream socket provides
* for the bidirectional, reliable, sequenced, and unduplicated flow of data
* without record boundaries. Aside from the bidirectionality of data flow,
* a pair of connected stream sockets provides an interface nearly identical
* to pipes.
*
* 0 (Protocol) - Specifies a particular protocol to be used with the
* socket. Specifying a protocol of 0 causes socket() to use an unspecified
* default protocol appropriate for the requested socket type.
*/
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
error();
}
/**
* Server Address Information
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area.
*
* We bind the server_addr to the internet address and port number thus
* giving our socket an identity with an address and port where it can
* listen for connections
*
* htons - The htons() function translates a short integer from host byte
* order to network byte order
*
* htonl - The htonl() function translates a long integer from host byte
* order to network byte order
*
* These functions are necessary so that the binding of address and port
* takes place with data in the correct format
*/
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(PORT);
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
printf("Client is running...\n");
/**
* Connects the client to the server address using the socket descriptor
* This enables the two to communicate and exchange data
*/
connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr));
printf("Client is connected...\n");
/**
* Communication between client and server
*
* The bzero() function erases the data in the n bytes of the memory
* starting at the location pointed to, by writing zeros (bytes
* containing '\0') to that area. The variables are emptied and then
* ready for use
*
* First the CLIENT receives the servers message and displays it (recv())
*
* The CLIENT is then prompted to type in a message and send it to the
* server. (send())
*
* The server and client can communicate till one of them exits the
* connection
*
* Since the exchange of information between the server and client take
* place one at a time this represents HALF DUPLEX COMMUNICATION
*/
while (1)
{
bzero(&serverResponse, sizeof(serverResponse));
bzero(&clientResponse, sizeof(clientResponse));
/// Receive Message
recv(sockfd, serverResponse, sizeof(serverResponse), 0);
printf("\nServer message: %s \n", serverResponse);
/// Send Message
printf("\nEnter message here: ");
fgets(clientResponse, 10000, stdin);
send(sockfd, clientResponse, strlen(clientResponse) + 1, 0);
}
/// Close Socket
close(sockfd);
printf("Client is offline...\n");
return 0;
}
================================================
FILE: client_server/tcp_half_duplex_server.c
================================================
/**
* @file
* @author [NVombat](https://github.com/NVombat)
* @brief Server-side implementation of [TCP Half Duplex
* Communication](http://www.tcpipguide.com/free/t_SimplexFullDuplexandHalfDuplexOperation.htm)
* @see tcp_half_duplex_server.c
*
* @details
* The algorithm is based on the simple TCP client and server model. However,
* instead of the server only sending and the client only receiving data,
* The server and client can both send data but only one at a time. This is
* implemented by using a particular ordering of the `send()` and `recv()`
* functions. When one of the clients or servers is sending, the other can only
* receive and vice-versa. In this way, the Half Duplex Form of communication
* can be represented using the TCP server-client model & socket programming
*/
#ifdef _WIN32
#define bzero(b, len) \
gitextract_1eckva4m/
├── .clang-format
├── .clang-tidy
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── feature_request.yml
│ │ └── other.yml
│ ├── labeler.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── approved-label.yml
│ ├── awesome_workflow.yml
│ ├── codeql.yml
│ ├── directory_writer.yml
│ ├── gh-pages.yml
│ ├── labeler.yml
│ ├── leetcode_directory_writer.yml
│ └── stale.yml
├── .gitignore
├── .gitpod.dockerfile
├── .gitpod.yml
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CodingGuidelines.md
├── DIRECTORY.md
├── Doxyfile
├── LICENSE
├── README.md
├── REVIEWER_CODE.md
├── audio/
│ ├── CMakeLists.txt
│ └── alaw.c
├── cipher/
│ ├── CMakeLists.txt
│ ├── affine.c
│ └── rot13.c
├── client_server/
│ ├── CMakeLists.txt
│ ├── bool.h
│ ├── client.c
│ ├── fork.h
│ ├── remote_command_exec_udp_client.c
│ ├── remote_command_exec_udp_server.c
│ ├── server.c
│ ├── tcp_full_duplex_client.c
│ ├── tcp_full_duplex_server.c
│ ├── tcp_half_duplex_client.c
│ ├── tcp_half_duplex_server.c
│ ├── udp_client.c
│ └── udp_server.c
├── conversions/
│ ├── CMakeLists.txt
│ ├── binary_to_decimal.c
│ ├── binary_to_hexadecimal.c
│ ├── binary_to_octal.c
│ ├── c_atoi_str_to_integer.c
│ ├── celsius_to_fahrenheit.c
│ ├── decimal_to_any_base.c
│ ├── decimal_to_binary.c
│ ├── decimal_to_binary_recursion.c
│ ├── decimal_to_hexa.c
│ ├── decimal_to_octal.c
│ ├── decimal_to_octal_recursion.c
│ ├── hexadecimal_to_octal.c
│ ├── hexadecimal_to_octal2.c
│ ├── infix_to_postfix.c
│ ├── infix_to_postfix2.c
│ ├── int_to_string.c
│ ├── octal_to_binary.c
│ ├── octal_to_decimal.c
│ ├── octal_to_hexadecimal.c
│ ├── roman_numerals_to_decimal.c
│ └── to_decimal.c
├── data_structures/
│ ├── array/
│ │ ├── README.md
│ │ ├── carray.c
│ │ ├── carray.h
│ │ └── carray_tests.c
│ ├── binary_trees/
│ │ ├── avl_tree.c
│ │ ├── binary_search_tree.c
│ │ ├── create_node.c
│ │ ├── recursive_traversals.c
│ │ ├── red_black_tree.c
│ │ ├── segment_tree.c
│ │ ├── threaded_binary_trees.c
│ │ └── words_alphabetical.c
│ ├── dictionary/
│ │ ├── README.md
│ │ ├── dict.c
│ │ ├── dict.h
│ │ └── test_program.c
│ ├── dynamic_array/
│ │ ├── Makefile
│ │ ├── dynamic_array.c
│ │ ├── dynamic_array.h
│ │ └── main.c
│ ├── graphs/
│ │ ├── Makefile
│ │ ├── bellman_ford.c
│ │ ├── bfs.c
│ │ ├── bfs_queue.c
│ │ ├── dfs.c
│ │ ├── dfs_recursive.c
│ │ ├── dijkstra.c
│ │ ├── euler.c
│ │ ├── floyd_warshall.c
│ │ ├── graph.c
│ │ ├── graph.h
│ │ ├── hamiltonian.c
│ │ ├── kruskal.c
│ │ ├── queue.c
│ │ ├── queue.h
│ │ ├── strongly_connected_components.c
│ │ ├── topological_sort.c
│ │ └── transitive_closure.c
│ ├── hash_set/
│ │ ├── Makefile
│ │ ├── hash_set.c
│ │ ├── hash_set.h
│ │ └── main.c
│ ├── heap/
│ │ ├── max_heap.c
│ │ └── min_heap.c
│ ├── linked_list/
│ │ ├── ascending_priority_queue.c
│ │ ├── circular_doubly_linked_list.c
│ │ ├── circular_linked_list.c
│ │ ├── doubly_linked_list.c
│ │ ├── merge_linked_lists.c
│ │ ├── middle_element_in_list.c
│ │ ├── queue_linked_list.c
│ │ ├── singly_link_list_deletion.c
│ │ └── stack_using_linked_lists.c
│ ├── list/
│ │ ├── Makefile
│ │ ├── list.c
│ │ ├── list.h
│ │ └── main.c
│ ├── queue/
│ │ ├── include.h
│ │ └── queue.c
│ ├── stack/
│ │ ├── README.md
│ │ ├── dynamic_stack.c
│ │ ├── main.c
│ │ ├── parenthesis.c
│ │ ├── stack.c
│ │ ├── stack.h
│ │ └── stack_linked_list/
│ │ ├── Makefile
│ │ ├── main.c
│ │ ├── stack.c
│ │ └── stack.h
│ ├── stack.c
│ ├── trie/
│ │ ├── dictionary.txt
│ │ └── trie.c
│ └── vector.c
├── developer_tools/
│ ├── CMakeLists.txt
│ ├── malloc_dbg.c
│ ├── malloc_dbg.h
│ ├── min_printf.h
│ ├── test_malloc_dbg.c
│ └── test_min_printf.c
├── dynamic_programming/
│ ├── CMakeLists.txt
│ ├── lcs.c
│ └── matrix_chain_order.c
├── exercism/
│ ├── README.md
│ ├── acronym/
│ │ ├── acronym.c
│ │ └── acronym.h
│ ├── hello_world/
│ │ ├── hello_world.c
│ │ └── hello_world.h
│ ├── isogram/
│ │ ├── isogram.c
│ │ └── isogram.h
│ ├── rna_transcription/
│ │ ├── rna_transcription.c
│ │ └── rna_transcription.h
│ └── word_count/
│ ├── word_count.c
│ └── word_count.h
├── games/
│ ├── CMakeLists.txt
│ ├── hangman.c
│ ├── naval_battle.c
│ ├── tic_tac_toe.c
│ └── words.txt
├── geometry/
│ ├── CMakeLists.txt
│ ├── geometry_datatypes.h
│ ├── quaternions.c
│ └── vectors_3d.c
├── graphics/
│ ├── CMakeLists.txt
│ └── spirograph.c
├── greedy_approach/
│ ├── dijkstra.c
│ └── prim.c
├── hash/
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── hash_adler32.c
│ ├── hash_blake2b.c
│ ├── hash_crc32.c
│ ├── hash_djb2.c
│ ├── hash_sdbm.c
│ └── hash_xor8.c
├── leetcode/
│ ├── DIRECTORY.md
│ ├── README.md
│ └── src/
│ ├── 1.c
│ ├── 10.c
│ ├── 1008.c
│ ├── 1009.c
│ ├── 101.c
│ ├── 1019.c
│ ├── 1026.c
│ ├── 104.c
│ ├── 108.c
│ ├── 1089.c
│ ├── 109.c
│ ├── 11.c
│ ├── 110.c
│ ├── 112.c
│ ├── 1137.c
│ ├── 1147.c
│ ├── 118.c
│ ├── 1184.c
│ ├── 1189.c
│ ├── 119.c
│ ├── 12.c
│ ├── 1207.c
│ ├── 121.c
│ ├── 124.c
│ ├── 125.c
│ ├── 1283.c
│ ├── 13.c
│ ├── 136.c
│ ├── 14.c
│ ├── 141.c
│ ├── 142.c
│ ├── 1524.c
│ ├── 153.c
│ ├── 16.c
│ ├── 160.c
│ ├── 1653.c
│ ├── 1657.c
│ ├── 169.c
│ ├── 1695.c
│ ├── 17.c
│ ├── 1704.c
│ ├── 173.c
│ ├── 1752.c
│ ├── 1769.c
│ ├── 1833.c
│ ├── 1838.c
│ ├── 189.c
│ ├── 19.c
│ ├── 190.c
│ ├── 191.c
│ ├── 2.c
│ ├── 20.c
│ ├── 201.c
│ ├── 2024.c
│ ├── 203.c
│ ├── 206.c
│ ├── 2095.c
│ ├── 21.c
│ ├── 2125.c
│ ├── 2130.c
│ ├── 215.c
│ ├── 217.c
│ ├── 2222.c
│ ├── 223.c
│ ├── 2256.c
│ ├── 226.c
│ ├── 2270.c
│ ├── 2279.c
│ ├── 230.c
│ ├── 2304.c
│ ├── 231.c
│ ├── 234.c
│ ├── 236.c
│ ├── 24.c
│ ├── 242.c
│ ├── 2482.c
│ ├── 2501.c
│ ├── 26.c
│ ├── 268.c
│ ├── 27.c
│ ├── 274.c
│ ├── 278.c
│ ├── 28.c
│ ├── 283.c
│ ├── 287.c
│ ├── 29.c
│ ├── 3.c
│ ├── 32.c
│ ├── 344.c
│ ├── 35.c
│ ├── 367.c
│ ├── 37.c
│ ├── 38.c
│ ├── 387.c
│ ├── 389.c
│ ├── 4.c
│ ├── 404.c
│ ├── 42.c
│ ├── 434.c
│ ├── 442.c
│ ├── 45.c
│ ├── 461.c
│ ├── 476.c
│ ├── 485.c
│ ├── 5.c
│ ├── 50.c
│ ├── 509.c
│ ├── 520.c
│ ├── 53.c
│ ├── 540.c
│ ├── 561.c
│ ├── 567.c
│ ├── 6.c
│ ├── 617.c
│ ├── 62.c
│ ├── 63.c
│ ├── 647.c
│ ├── 66.c
│ ├── 669.c
│ ├── 674.c
│ ├── 684.c
│ ├── 69.c
│ ├── 7.c
│ ├── 700.c
│ ├── 701.c
│ ├── 704.c
│ ├── 709.c
│ ├── 75.c
│ ├── 771.c
│ ├── 79.c
│ ├── 8.c
│ ├── 807.c
│ ├── 82.c
│ ├── 83.c
│ ├── 841.c
│ ├── 852.c
│ ├── 876.c
│ ├── 9.c
│ ├── 901.c
│ ├── 905.c
│ ├── 917.c
│ ├── 931.c
│ ├── 938.c
│ ├── 94.c
│ ├── 953.c
│ ├── 965.c
│ ├── 977.c
│ ├── 979.c
│ ├── 98.c
│ ├── 985.c
│ └── 997.c
├── machine_learning/
│ ├── CMakeLists.txt
│ ├── adaline_learning.c
│ ├── k_means_clustering.c
│ ├── kohonen_som_topology.c
│ └── kohonen_som_trace.c
├── math/
│ ├── CMakeLists.txt
│ ├── armstrong_number.c
│ ├── cantor_set.c
│ ├── cartesian_to_polar.c
│ ├── catalan.c
│ ├── collatz.c
│ ├── euclidean_algorithm_extended.c
│ ├── factorial.c
│ ├── factorial_large_number.c
│ ├── factorial_trailing_zeroes.c
│ ├── fibonacci.c
│ ├── fibonacci_dp.c
│ ├── fibonacci_fast.c
│ ├── fibonacci_formula.c
│ ├── gcd.c
│ ├── is_armstrong.c
│ ├── large_factorials.c
│ ├── lcm.c
│ ├── lerp.c
│ ├── palindrome.c
│ ├── prime.c
│ ├── prime_factoriziation.c
│ ├── prime_sieve.c
│ └── strong_number.c
├── misc/
│ ├── CMakeLists.txt
│ ├── demonetization.c
│ ├── hamming_distance.c
│ ├── lexicographic_permutations.c
│ ├── longest_subsequence.c
│ ├── mcnaughton_yamada_thompson.c
│ ├── mirror.c
│ ├── pid.c
│ ├── poly_add.c
│ ├── postfix_evaluation.c
│ ├── quartile.c
│ ├── rselect.c
│ ├── run_length_encoding.c
│ ├── shunting_yard.c
│ ├── sudoku_solver.c
│ ├── tower_of_hanoi.c
│ └── union_find.c
├── numerical_methods/
│ ├── CMakeLists.txt
│ ├── bisection_method.c
│ ├── durand_kerner_roots.c
│ ├── gauss_elimination.c
│ ├── gauss_seidel_method.c
│ ├── lagrange_theorem.c
│ ├── lu_decompose.c
│ ├── mean.c
│ ├── median.c
│ ├── newton_raphson_root.c
│ ├── ode_forward_euler.c
│ ├── ode_midpoint_euler.c
│ ├── ode_semi_implicit_euler.c
│ ├── qr_decompose.h
│ ├── qr_decomposition.c
│ ├── qr_eigen_values.c
│ ├── realtime_stats.c
│ ├── secant_method.c
│ ├── simpsons_1_3rd_rule.c
│ └── variance.c
├── process_scheduling_algorithms/
│ ├── CMakeLists.txt
│ └── non_preemptive_priority_scheduling.c
├── project_euler/
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── problem_1/
│ │ ├── sol1.c
│ │ ├── sol2.c
│ │ ├── sol3.c
│ │ └── sol4.c
│ ├── problem_10/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_12/
│ │ └── sol1.c
│ ├── problem_13/
│ │ ├── num.txt
│ │ └── sol1.c
│ ├── problem_14/
│ │ └── sol1.c
│ ├── problem_15/
│ │ └── sol1.c
│ ├── problem_16/
│ │ └── sol1.c
│ ├── problem_19/
│ │ └── sol1.c
│ ├── problem_2/
│ │ └── so1.c
│ ├── problem_20/
│ │ └── sol1.c
│ ├── problem_21/
│ │ └── sol1.c
│ ├── problem_22/
│ │ ├── names.txt
│ │ └── sol1.c
│ ├── problem_23/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_24/
│ │ └── sol1
│ ├── problem_25/
│ │ └── sol1.c
│ ├── problem_26/
│ │ └── sol1.c
│ ├── problem_3/
│ │ ├── sol1.c
│ │ └── sol2.c
│ ├── problem_4/
│ │ └── sol.c
│ ├── problem_401/
│ │ └── sol1.c
│ ├── problem_5/
│ │ ├── sol1.c
│ │ ├── sol2.c
│ │ └── sol3.c
│ ├── problem_6/
│ │ └── sol.c
│ ├── problem_7/
│ │ ├── sol.c
│ │ └── sol2.c
│ ├── problem_8/
│ │ ├── digits.txt
│ │ ├── sol1.c
│ │ └── sol2.c
│ └── problem_9/
│ ├── sol1.c
│ └── sol2.c
├── scripts/
│ ├── file_linter.py
│ └── leetcode_directory_md.py
├── searching/
│ ├── CMakeLists.txt
│ ├── binary_search.c
│ ├── exponential_search.c
│ ├── fibonacci_search.c
│ ├── floyd_cycle_detection_algorithm.c
│ ├── interpolation_search.c
│ ├── jump_search.c
│ ├── linear_search.c
│ ├── modified_binary_search.c
│ ├── other_binary_search.c
│ ├── pattern_search/
│ │ ├── CMakeLists.txt
│ │ ├── boyer_moore_search.c
│ │ ├── naive_search.c
│ │ └── rabin_karp_search.c
│ ├── sentinel_linear_search.c
│ └── ternary_search.c
└── sorting/
├── CMakeLists.txt
├── bead_sort.c
├── binary_insertion_sort.c
├── bogo_sort.c
├── bubble_sort.c
├── bubble_sort_2.c
├── bubble_sort_recursion.c
├── bucket_sort.c
├── cocktail_sort.c
├── comb_sort.c
├── counting_sort.c
├── cycle_sort.c
├── gnome_sort.c
├── heap_sort.c
├── heap_sort_2.c
├── insertion_sort.c
├── insertion_sort_recursive.c
├── merge_sort.c
├── merge_sort_nr.c
├── multikey_quick_sort.c
├── odd_even_sort.c
├── pancake_sort.c
├── partition_sort.c
├── patience_sort.c
├── pigeonhole_sort.c
├── quick_sort.c
├── radix_sort.c
├── radix_sort_2.c
├── random_quick_sort.c
├── selection_sort.c
├── selection_sort_recursive.c
├── shaker_sort.c
├── shell_sort.c
├── shell_sort2.c
└── stooge_sort.c
SYMBOL INDEX (1609 symbols across 406 files)
FILE: audio/alaw.c
function encode (line 46) | void encode(uint8_t *out, int16_t *in, size_t len)
function decode (line 107) | void decode(int16_t *out, uint8_t *in, size_t len)
function test (line 148) | static void test(int16_t *pcm, uint8_t *coded, int16_t *decoded, size_t ...
function main (line 175) | int main(int argc, char *argv[])
FILE: cipher/affine.c
type affine_key_t (line 33) | typedef struct
function modular_multiplicative_inverse (line 47) | int modular_multiplicative_inverse(unsigned int a, unsigned int m)
function affine_key_t (line 87) | affine_key_t inverse_key(affine_key_t key)
function affine_encrypt (line 110) | void affine_encrypt(char *s, affine_key_t key)
function affine_decrypt (line 132) | void affine_decrypt(char *s, affine_key_t key)
function test_string (line 157) | void test_string(const char *s, const char *ciphertext, int a, int b)
function tests (line 179) | static void tests()
function main (line 203) | int main()
FILE: cipher/rot13.c
function rot13 (line 23) | void rot13(char *s) {
function test (line 37) | static void test() {
function main (line 57) | int main() {
FILE: client_server/bool.h
type BOOL (line 33) | typedef enum
type BOOL (line 43) | typedef int BOOL;
FILE: client_server/client.c
function func (line 37) | void func(int sockfd)
function cleanup (line 64) | void cleanup() { WSACleanup(); }
function main (line 70) | int main()
FILE: client_server/fork.h
type LONG (line 39) | typedef LONG NTSTATUS;
type SYSTEM_HANDLE_INFORMATION (line 41) | typedef struct _SYSTEM_HANDLE_INFORMATION
type OBJECT_ATTRIBUTES (line 51) | typedef struct _OBJECT_ATTRIBUTES
type MEMORY_INFORMATION_CLASS (line 61) | typedef enum _MEMORY_INFORMATION_
type CLIENT_ID (line 69) | typedef struct _CLIENT_ID
type USER_STACK (line 75) | typedef struct _USER_STACK
type LONG (line 84) | typedef LONG KPRIORITY;
type ULONG_PTR (line 85) | typedef ULONG_PTR KAFFINITY;
type KAFFINITY (line 86) | typedef KAFFINITY *PKAFFINITY;
type THREAD_BASIC_INFORMATION (line 88) | typedef struct _THREAD_BASIC_INFORMATION
type SYSTEM_INFORMATION_CLASS (line 98) | typedef enum _SYSTEM_INFORMATION_CLASS
function child_entry (line 160) | static int child_entry(void)
function BOOL (line 166) | static BOOL haveLoadedFunctionsForFork(void)
function fork (line 218) | int fork(void)
FILE: client_server/remote_command_exec_udp_client.c
function error (line 46) | void error()
function main (line 56) | int main()
FILE: client_server/remote_command_exec_udp_server.c
function error (line 46) | void error()
function main (line 56) | int main()
FILE: client_server/server.c
function cleanup (line 39) | void cleanup() { WSACleanup(); }
function func (line 47) | void func(int sockfd)
function main (line 81) | int main()
FILE: client_server/tcp_full_duplex_client.c
function error (line 52) | void error()
function main (line 62) | int main()
FILE: client_server/tcp_full_duplex_server.c
function error (line 52) | void error()
function main (line 62) | int main()
FILE: client_server/tcp_half_duplex_client.c
function error (line 45) | void error()
function main (line 55) | int main()
FILE: client_server/tcp_half_duplex_server.c
function error (line 45) | void error()
function main (line 55) | int main()
FILE: client_server/udp_client.c
function cleanup (line 31) | void cleanup() { WSACleanup(); }
function main (line 35) | int main()
FILE: client_server/udp_server.c
function cleanup (line 31) | void cleanup() { WSACleanup(); }
function main (line 35) | int main()
FILE: conversions/binary_to_decimal.c
function convert_to_decimal (line 29) | int convert_to_decimal(uint64_t number) {
function tests (line 45) | static void tests() {
function main (line 64) | int main()
FILE: conversions/binary_to_hexadecimal.c
function main (line 6) | int main()
FILE: conversions/binary_to_octal.c
function three_digits (line 5) | int three_digits(int n)
function main (line 19) | int main(void)
FILE: conversions/c_atoi_str_to_integer.c
function c_atoi (line 16) | int c_atoi(const char *str)
function test_c_atoi (line 62) | void test_c_atoi()
function main (line 78) | int main(int argc, char **argv)
FILE: conversions/celsius_to_fahrenheit.c
function celcius_to_fahrenheit (line 17) | double celcius_to_fahrenheit(double celsius) {
function test (line 25) | static void test() {
function main (line 71) | int main() {
FILE: conversions/decimal_to_any_base.c
function isbad_alphabet (line 20) | bool isbad_alphabet(const char* alphabet) {
function converted_len (line 42) | uint64_t converted_len(uint64_t nb, short base) {
function convertion (line 58) | void convertion(uint64_t nb, const char* alphabet, short base, char* con...
function test (line 94) | static void test()
function main (line 165) | int main()
FILE: conversions/decimal_to_binary.c
function main (line 6) | int main()
FILE: conversions/decimal_to_binary_recursion.c
function decimal_to_binary (line 14) | int decimal_to_binary(unsigned int number)
function test (line 20) | void test()
function main (line 34) | int main()
FILE: conversions/decimal_to_hexa.c
function main (line 5) | int main()
function decimal2Hexadecimal (line 19) | void decimal2Hexadecimal(long num)
FILE: conversions/decimal_to_octal.c
function main (line 5) | int main()
function decimal2Octal (line 18) | void decimal2Octal(long decimalnum)
FILE: conversions/decimal_to_octal_recursion.c
function decimal_to_octal (line 6) | int decimal_to_octal(int decimal)
function main (line 21) | int main()
FILE: conversions/hexadecimal_to_octal.c
function main (line 5) | int main()
FILE: conversions/hexadecimal_to_octal2.c
function main (line 104) | int main()
FILE: conversions/infix_to_postfix.c
type Stack (line 17) | struct Stack
type Stack (line 24) | struct Stack
type Stack (line 25) | struct Stack
type Stack (line 27) | struct Stack
function main (line 36) | int main()
function push (line 55) | void push(struct Stack *p, char x)
function pop (line 72) | char pop(struct Stack *p)
function isOprnd (line 93) | int isOprnd(char ch)
function isEmpty (line 112) | int isEmpty(struct Stack s)
function convert (line 130) | void convert(char infix[], char postfix[])
function getPrecedence (line 201) | int getPrecedence (char op1, char op2)
FILE: conversions/infix_to_postfix2.c
type Stack (line 21) | struct Stack {
type Stack (line 25) | struct Stack
function push (line 32) | void push(char opd) {
function pop (line 45) | char pop() {
function isEmpty (line 61) | uint16_t isEmpty() {
function Top (line 72) | char Top() {
function priority (line 83) | int16_t priority(char opr) {
function test (line 139) | static void test() {
function main (line 156) | int main() {
FILE: conversions/int_to_string.c
function test (line 51) | static void test()
function main (line 77) | int main()
FILE: conversions/octal_to_binary.c
function octalToBinary (line 16) | long octalToBinary(int octalnum)
function main (line 52) | int main()
FILE: conversions/octal_to_decimal.c
function convertValue (line 5) | int convertValue(int num, int i) { return num * pow(8, i); }
function toDecimal (line 7) | long long toDecimal(int octal_value)
function main (line 23) | int main()
FILE: conversions/octal_to_hexadecimal.c
function octalToDecimal (line 20) | long octalToDecimal(long octalValue){
function test (line 48) | static void test() {
function main (line 60) | int main()
FILE: conversions/roman_numerals_to_decimal.c
function symbol (line 18) | int symbol(char symbol) {
function roman_to_decimal (line 51) | int roman_to_decimal(char input[]) {
function test (line 73) | static void test() {
function main (line 118) | int main() {
FILE: conversions/to_decimal.c
function main (line 8) | int main(void)
FILE: data_structures/array/carray.c
function CArray (line 36) | CArray *getCArray(int size)
function insertValueCArray (line 49) | int insertValueCArray(CArray *array, int position, int value)
function removeValueCArray (line 64) | int removeValueCArray(CArray *array, int position)
function pushValueCArray (line 78) | int pushValueCArray(CArray *array, int value)
function updateValueCArray (line 97) | int updateValueCArray(CArray *array, int position, int value)
function eraseCArray (line 113) | int eraseCArray(CArray *array)
function switchValuesCArray (line 123) | int switchValuesCArray(CArray *array, int position1, int position2)
function reverseCArray (line 136) | int reverseCArray(CArray *array)
function displayCArray (line 146) | int displayCArray(CArray *array)
function blenderCArray (line 158) | int blenderCArray(CArray *array)
function CArray (line 170) | CArray *getCopyCArray(CArray *arr)
function swap (line 183) | void swap(CArray *array, int position1, int position2)
function bubbleSortCArray (line 190) | int bubbleSortCArray(CArray *array)
function selectionSortCArray (line 206) | int selectionSortCArray(CArray *array)
function insertionSortCArray (line 220) | int insertionSortCArray(CArray *array)
function valueOcurranceCArray (line 237) | int valueOcurranceCArray(CArray *array, int value)
function CArray (line 248) | CArray *valuePositionsCArray(CArray *array, int value)
function findMinCArray (line 265) | int findMinCArray(CArray *array)
function findMaxCArray (line 279) | int findMaxCArray(CArray *array)
FILE: data_structures/array/carray.h
type CArray (line 31) | typedef struct CArray
FILE: data_structures/array/carray_tests.c
function CArrayTests (line 21) | int CArrayTests()
FILE: data_structures/binary_trees/avl_tree.c
type AVLnode (line 4) | struct AVLnode
type avlNode (line 11) | typedef struct AVLnode avlNode;
function max (line 13) | int max(int a, int b) { return (a > b) ? a : b; }
function avlNode (line 15) | avlNode *newNode(int key)
function nodeHeight (line 32) | int nodeHeight(avlNode *node)
function heightDiff (line 40) | int heightDiff(avlNode *node)
function avlNode (line 49) | avlNode *minNode(avlNode *node)
function printAVL (line 58) | void printAVL(avlNode *node, int level)
function avlNode (line 74) | avlNode *rightRotate(avlNode *z)
function avlNode (line 88) | avlNode *leftRotate(avlNode *z)
function avlNode (line 102) | avlNode *LeftRightRotate(avlNode *z)
function avlNode (line 109) | avlNode *RightLeftRotate(avlNode *z)
function avlNode (line 116) | avlNode *insert(avlNode *node, int key)
function avlNode (line 159) | avlNode *delete (avlNode *node, int queryNum)
function avlNode (line 233) | avlNode *findNode(avlNode *node, int queryNum)
function printPreOrder (line 246) | void printPreOrder(avlNode *node)
function printInOrder (line 256) | void printInOrder(avlNode *node)
function printPostOrder (line 265) | void printPostOrder(avlNode *node)
function main (line 274) | int main()
FILE: data_structures/binary_trees/binary_search_tree.c
type node (line 14) | typedef struct node
function node (line 28) | node *newNode(int data)
function node (line 46) | node *insert(node *root, int data)
function node (line 72) | node *getMax(node *root)
function node (line 88) | node *delete (node *root, int data)
function find (line 152) | int find(node *root, int data)
function height (line 187) | int height(node *root)
function purge (line 217) | void purge(node *root)
function inOrder (line 238) | void inOrder(node *root)
function main (line 249) | int main()
FILE: data_structures/binary_trees/create_node.c
type node (line 10) | struct node
type node (line 17) | struct node
type node (line 19) | struct node
type node (line 19) | struct node
type node (line 19) | struct node
function main (line 28) | int main(void)
FILE: data_structures/binary_trees/recursive_traversals.c
function inOrderTraversal (line 8) | void inOrderTraversal(struct node *node)
function preOrderTraversal (line 18) | void preOrderTraversal(struct node *node)
function postOrderTraversal (line 28) | void postOrderTraversal(struct node *node)
function main (line 38) | int main(void)
FILE: data_structures/binary_trees/red_black_tree.c
type Node (line 5) | typedef struct node
function Node (line 15) | Node *newNode(int val, Node *par)
function isLeaf (line 26) | int isLeaf(Node *n)
function Node (line 36) | Node *leftRotate(Node *node)
function Node (line 64) | Node *rightRotate(Node *node)
function checkNode (line 92) | void checkNode(Node *node)
function insertNode (line 284) | void insertNode(int val, Node **root)
function checkForCase2 (line 343) | void checkForCase2(Node *toDelete, int delete, int fromDirection, Node *...
function deleteNode (line 605) | void deleteNode(int val, Node **root)
function printInorder (line 720) | void printInorder(Node *root)
function checkBlack (line 730) | void checkBlack(Node *temp, int c)
function main (line 745) | int main()
FILE: data_structures/binary_trees/segment_tree.c
type segment_tree (line 38) | typedef struct segment_tree
function segment_tree_build (line 55) | void segment_tree_build(segment_tree *tree)
function segment_tree_update (line 79) | void segment_tree_update(segment_tree *tree, size_t index, void *val)
function segment_tree_query (line 105) | void segment_tree_query(segment_tree *tree, long long l, long long r, vo...
function segment_tree (line 140) | segment_tree *segment_tree_init(void *arr, size_t elem_size, size_t len,
function segment_tree_dispose (line 162) | void segment_tree_dispose(segment_tree *tree)
function segment_tree_print_int (line 175) | void segment_tree_print_int(segment_tree *tree)
function minimum (line 194) | void minimum(const void *a, const void *b, void *c)
function test (line 205) | static void test()
function main (line 231) | int main()
FILE: data_structures/binary_trees/threaded_binary_trees.c
type node (line 26) | typedef struct Node
function node (line 38) | node *create_node(int data)
function insert_bt (line 51) | void insert_bt(node **root, int data)
function search (line 98) | void search(node *root, int ele)
function inorder_display (line 129) | void inorder_display(node *curr)
function postorder_display (line 143) | void postorder_display(node *curr)
function preorder_display (line 157) | void preorder_display(node *curr)
function delete_bt (line 173) | void delete_bt(node **root, int ele)
function main (line 255) | int main()
FILE: data_structures/binary_trees/words_alphabetical.c
type Node (line 28) | struct Node
function endProgramAbruptly (line 41) | void endProgramAbruptly(char *errorMessage)
function freeTreeMemory (line 52) | void freeTreeMemory(struct Node *node)
function closeFile (line 90) | void closeFile(FILE *file)
type Node (line 102) | struct Node
type Node (line 104) | struct Node
type Node (line 105) | struct Node
type Node (line 105) | struct Node
function writeContentOfTreeToFile (line 121) | void writeContentOfTreeToFile(struct Node *node, FILE *file)
type Node (line 144) | struct Node
type Node (line 144) | struct Node
type Node (line 148) | struct Node
type Node (line 182) | struct Node
type Node (line 182) | struct Node
function test (line 244) | static void test()
function main (line 312) | int main()
FILE: data_structures/dictionary/dict.c
function Dictionary (line 6) | Dictionary *create_dict(void)
function get_hash (line 33) | int get_hash(char s[])
function add_item_label (line 49) | int add_item_label(Dictionary *dic, char label[], void *item)
function add_item_index (line 64) | int add_item_index(Dictionary *dic, int index, void *item)
function destroy (line 100) | void destroy(Dictionary *dict) { free(dict); }
FILE: data_structures/dictionary/dict.h
type Dictionary (line 17) | typedef struct Dict
FILE: data_structures/dictionary/test_program.c
function main (line 11) | int main(void)
FILE: data_structures/dynamic_array/dynamic_array.c
function dynamic_array_t (line 6) | dynamic_array_t *init_dynamic_array()
function delete (line 51) | void delete (dynamic_array_t *da, const unsigned index)
function contains (line 66) | unsigned contains(const unsigned size, const unsigned index)
FILE: data_structures/dynamic_array/dynamic_array.h
type dynamic_array_t (line 6) | typedef struct dynamic_array
FILE: data_structures/dynamic_array/main.c
function main (line 5) | int main()
FILE: data_structures/graphs/bellman_ford.c
type Edge (line 7) | struct Edge
type Graph (line 13) | struct Graph
function createGraph (line 21) | void createGraph(struct Graph *G, int V, int E)
function addEdge (line 29) | void addEdge(struct Graph *G, int src, int dst, int weight)
function minDistance (line 40) | int minDistance(int mdist[], int vset[], int V)
function print (line 54) | void print(int dist[], int V)
function BellmanFord (line 69) | void BellmanFord(struct Graph *graph, int src)
function main (line 115) | int main()
FILE: data_structures/graphs/bfs.c
type queue (line 5) | struct queue
type queue (line 13) | struct queue
type queue (line 14) | struct queue
type queue (line 15) | struct queue
type queue (line 16) | struct queue
type queue (line 17) | struct queue
type queue (line 18) | struct queue
type node (line 21) | struct node
type node (line 27) | struct node
type Graph (line 30) | struct Graph
type Graph (line 36) | struct Graph
type Graph (line 37) | struct Graph
type Graph (line 38) | struct Graph
type Graph (line 39) | struct Graph
function main (line 41) | int main()
function bfs (line 74) | void bfs(struct Graph *graph, int startVertex)
type node (line 106) | struct node
type node (line 108) | struct node
type node (line 108) | struct node
type Graph (line 114) | struct Graph
type Graph (line 116) | struct Graph
type Graph (line 116) | struct Graph
type node (line 119) | struct node
function addEdge (line 132) | void addEdge(struct Graph *graph, int src, int dest)
type queue (line 145) | struct queue
type queue (line 147) | struct queue
type queue (line 147) | struct queue
function isEmpty (line 153) | int isEmpty(struct queue *q)
function enqueue (line 161) | void enqueue(struct queue *q, int value)
function dequeue (line 174) | int dequeue(struct queue *q)
function pollQueue (line 195) | int pollQueue(struct queue *q) { return q->items[q->front]; }
FILE: data_structures/graphs/bfs_queue.c
function findPathBFS (line 11) | bool findPathBFS(Graph g, int nV, Vertex src, Vertex dest)
function main (line 36) | int main(void)
FILE: data_structures/graphs/dfs.c
type node (line 5) | struct node
type node (line 11) | struct node
type Graph (line 12) | struct Graph
type Graph (line 20) | struct Graph
type Graph (line 21) | struct Graph
type Graph (line 22) | struct Graph
type Graph (line 23) | struct Graph
function main (line 25) | int main()
function dfs (line 60) | void dfs(struct Graph *graph, int vertex)
type node (line 81) | struct node
type node (line 83) | struct node
type node (line 83) | struct node
type Graph (line 89) | struct Graph
type Graph (line 91) | struct Graph
type Graph (line 91) | struct Graph
type node (line 94) | struct node
function addEdge (line 107) | void addEdge(struct Graph *graph, int src, int dest)
function printGraph (line 120) | void printGraph(struct Graph *graph)
FILE: data_structures/graphs/dfs_recursive.c
function dfsPathCheck (line 10) | bool dfsPathCheck(Graph g, int nV, Vertex v, Vertex dest)
function findPathDFS (line 25) | bool findPathDFS(Graph g, int nV, Vertex src, Vertex dest)
function main (line 33) | int main(void)
FILE: data_structures/graphs/dijkstra.c
type Graph (line 7) | struct Graph
function createGraph (line 14) | void createGraph(struct Graph *G, int V)
function addEdge (line 27) | void addEdge(struct Graph *G, int src, int dst, int weight)
function minDistance (line 33) | int minDistance(int mdist[], int vset[], int V)
function print (line 48) | void print(int dist[], int V)
function Dijkstra (line 63) | void Dijkstra(struct Graph *graph, int src)
function main (line 95) | int main()
FILE: data_structures/graphs/euler.c
function degree (line 7) | int degree(Graph g, int nV, Vertex v)
function hasEulerPath (line 19) | bool hasEulerPath(Graph g, int nV, Vertex v, Vertex w)
function main (line 37) | int main(void)
FILE: data_structures/graphs/floyd_warshall.c
type Graph (line 7) | struct Graph
function createGraph (line 14) | void createGraph(struct Graph *G, int V)
function addEdge (line 27) | void addEdge(struct Graph *G, int src, int dst, int weight)
function print (line 33) | void print(int dist[], int V)
function FloydWarshall (line 51) | void FloydWarshall(struct Graph *graph)
function main (line 85) | int main()
FILE: data_structures/graphs/graph.c
type GraphRep (line 8) | typedef struct GraphRep
function Graph (line 15) | Graph newGraph(int V)
function validV (line 39) | bool validV(Graph g, Vertex v) { return (g != NULL && v >= 0 && v < g->n...
function insertEdge (line 41) | void insertEdge(Graph g, Edge e)
function removeEdge (line 53) | void removeEdge(Graph g, Edge e)
function adjacent (line 65) | bool adjacent(Graph g, Vertex v, Vertex w)
function showGraph (line 72) | void showGraph(Graph g)
function freeGraph (line 85) | void freeGraph(Graph g)
FILE: data_structures/graphs/graph.h
type GraphRep (line 4) | struct GraphRep
type Vertex (line 7) | typedef int Vertex;
type Edge (line 10) | typedef struct Edge
FILE: data_structures/graphs/hamiltonian.c
function hamiltonR (line 9) | bool hamiltonR(Graph g, int nV, Vertex v, Vertex dest, int d)
function hasHamiltonianPath (line 38) | bool hasHamiltonianPath(Graph g, int nV, Vertex src, Vertex dest)
function main (line 45) | int main(void)
FILE: data_structures/graphs/kruskal.c
type Edge (line 8) | struct Edge
type Graph (line 15) | struct Graph
type Graph (line 28) | struct Graph
type Graph (line 30) | struct Graph
type Graph (line 30) | struct Graph
type Graph (line 30) | struct Graph
type Edge (line 34) | struct Edge
type Edge (line 34) | struct Edge
type subset (line 40) | struct subset
function find (line 48) | int find(struct subset subsets[], int i)
function Union (line 60) | void Union(struct subset subsets[], int x, int y)
function myComp (line 83) | int myComp(const void *a, const void *b)
function KruskalMST (line 91) | void KruskalMST(struct Graph *graph)
function main (line 145) | int main()
FILE: data_structures/graphs/queue.c
type NodeT (line 7) | typedef struct node
type QueueRep (line 13) | typedef struct QueueRep
function queue (line 21) | queue newQueue()
function dropQueue (line 31) | void dropQueue(queue Q)
function QueueIsEmpty (line 44) | int QueueIsEmpty(queue Q) { return (Q->length == 0); }
function QueueEnqueue (line 47) | void QueueEnqueue(queue Q, int v)
function QueueDequeue (line 67) | int QueueDequeue(queue Q)
FILE: data_structures/graphs/queue.h
type QueueRep (line 3) | struct QueueRep
FILE: data_structures/graphs/strongly_connected_components.c
type node (line 6) | struct node
type node (line 12) | struct node
type Graph (line 13) | struct Graph
type Stack (line 22) | struct Stack
type Graph (line 27) | struct Graph
type Graph (line 28) | struct Graph
type Graph (line 29) | struct Graph
type Graph (line 30) | struct Graph
type Graph (line 30) | struct Graph
type Graph (line 31) | struct Graph
type Stack (line 31) | struct Stack
type Graph (line 32) | struct Graph
type Graph (line 33) | struct Graph
type Stack (line 34) | struct Stack
type Stack (line 35) | struct Stack
type Stack (line 36) | struct Stack
function main (line 38) | int main()
function fillOrder (line 70) | void fillOrder(int vertex, struct Graph *graph, struct Stack *stack)
type Graph (line 89) | struct Graph
type Graph (line 89) | struct Graph
type Graph (line 91) | struct Graph
type node (line 96) | struct node
function dfs (line 106) | void dfs(struct Graph *graph, int vertex)
function scc (line 128) | void scc(struct Graph *graph)
type node (line 156) | struct node
type node (line 158) | struct node
type node (line 158) | struct node
type Graph (line 164) | struct Graph
type Graph (line 166) | struct Graph
type Graph (line 166) | struct Graph
type node (line 168) | struct node
function addEdge (line 180) | void addEdge(struct Graph *graph, int src, int dest)
function printGraph (line 188) | void printGraph(struct Graph *graph)
type Stack (line 204) | struct Stack
type Stack (line 206) | struct Stack
type Stack (line 206) | struct Stack
function push (line 211) | void push(struct Stack *stack, int element)
function pop (line 217) | int pop(struct Stack *stack)
FILE: data_structures/graphs/topological_sort.c
type node (line 6) | struct node
type node (line 12) | struct node
type Graph (line 13) | struct Graph
type Stack (line 22) | struct Stack
type Graph (line 27) | struct Graph
type Graph (line 28) | struct Graph
type Graph (line 29) | struct Graph
type Graph (line 30) | struct Graph
type Stack (line 30) | struct Stack
type Graph (line 31) | struct Graph
type Stack (line 32) | struct Stack
type Stack (line 33) | struct Stack
type Stack (line 34) | struct Stack
function main (line 36) | int main()
function topologicalSortHelper (line 68) | void topologicalSortHelper(int vertex, struct Graph *graph, struct Stack...
function topologicalSort (line 88) | void topologicalSort(struct Graph *graph)
type node (line 103) | struct node
type node (line 105) | struct node
type node (line 105) | struct node
type Graph (line 111) | struct Graph
type Graph (line 113) | struct Graph
type Graph (line 113) | struct Graph
type node (line 115) | struct node
function addEdge (line 127) | void addEdge(struct Graph *graph, int src, int dest)
function printGraph (line 135) | void printGraph(struct Graph *graph)
type Stack (line 151) | struct Stack
type Stack (line 153) | struct Stack
type Stack (line 153) | struct Stack
function push (line 158) | void push(struct Stack *stack, int element)
function pop (line 164) | int pop(struct Stack *stack)
FILE: data_structures/graphs/transitive_closure.c
function warshall (line 10) | void warshall()
function main (line 23) | int main(void)
FILE: data_structures/hash_set/hash_set.c
function hash_set_t (line 6) | extern hash_set_t *init_hash_set()
function add (line 17) | unsigned add(hash_set_t *set, void *value)
function put (line 22) | unsigned put(hash_set_t *set, long long hash, void *value)
function contains (line 43) | int contains(hash_set_t *set, void *value)
function contains_hash (line 51) | int contains_hash(hash_set_t *set, long long hash)
function delete (line 56) | void delete (hash_set_t *set, void *value)
function hash (line 62) | long long hash(void *value)
function retrieve_index_from_hash (line 79) | unsigned retrieve_index_from_hash(const long long hash, const unsigned c...
function resize (line 84) | void resize(hash_set_t *set)
FILE: data_structures/hash_set/hash_set.h
type hash_set_t (line 6) | typedef struct
FILE: data_structures/hash_set/main.c
function main (line 5) | int main()
FILE: data_structures/heap/max_heap.c
type Heap (line 5) | typedef struct max_heap
function main (line 25) | int main()
function Heap (line 51) | Heap *create_heap(Heap *heap)
function down_heapify (line 60) | void down_heapify(Heap *heap, int index)
function up_heapify (line 93) | void up_heapify(Heap *heap, int index)
function push (line 107) | void push(Heap *heap, int x)
function pop (line 120) | void pop(Heap *heap)
function top (line 135) | int top(Heap *heap)
function empty (line 142) | int empty(Heap *heap)
function size (line 149) | int size(Heap *heap) { return heap->count; }
FILE: data_structures/heap/min_heap.c
type Heap (line 4) | typedef struct min_heap
function main (line 24) | int main()
function Heap (line 50) | Heap *create_heap(Heap *heap)
function down_heapify (line 59) | void down_heapify(Heap *heap, int index)
function up_heapify (line 92) | void up_heapify(Heap *heap, int index)
function push (line 106) | void push(Heap *heap, int x)
function pop (line 119) | void pop(Heap *heap)
function top (line 134) | int top(Heap *heap)
function empty (line 141) | int empty(Heap *heap)
function size (line 148) | int size(Heap *heap) { return heap->count; }
FILE: data_structures/linked_list/ascending_priority_queue.c
type node (line 29) | struct node
type node (line 35) | struct node
function createqueue (line 39) | void createqueue() { front = rear = NULL; }
function empty (line 41) | int empty()
function insert (line 49) | void insert(int x)
function removes (line 72) | int removes()
function show (line 119) | void show()
function destroyqueue (line 140) | void destroyqueue() { front = rear = NULL; }
function main (line 142) | int main()
FILE: data_structures/linked_list/circular_doubly_linked_list.c
type ListNode (line 28) | typedef struct node
function ListNode (line 39) | ListNode *create_node(uint64_t data)
function ListNode (line 55) | ListNode *insert_at_head(ListNode *head, uint64_t data)
function ListNode (line 84) | ListNode *insert_at_tail(ListNode *head, uint64_t data)
function ListNode (line 111) | ListNode *delete_from_head(ListNode *head)
function ListNode (line 140) | ListNode *delete_from_tail(ListNode *head)
function getsize (line 169) | int getsize(ListNode *head)
function display_list (line 191) | void display_list(ListNode *head)
function get (line 223) | uint64_t get(ListNode *list, const int index)
function test (line 241) | static void test()
function main (line 300) | int main()
FILE: data_structures/linked_list/circular_linked_list.c
type node (line 9) | struct node
type node (line 15) | struct node
type node (line 16) | struct node
function create (line 20) | void create()
function deletenode (line 53) | void deletenode(int k)
function traverse (line 92) | void traverse()
function main (line 114) | void main()
FILE: data_structures/linked_list/doubly_linked_list.c
type List (line 23) | typedef struct list
function main (line 79) | int main()
function List (line 92) | List *create(double value)
function List (line 108) | List *insert(List *list, double value, int pos)
function List (line 179) | List *delete(List *list, int pos)
function search (line 242) | int search(List *list, double value)
function print (line 256) | void print(List *list)
function example (line 269) | void example()
FILE: data_structures/linked_list/merge_linked_lists.c
type node (line 3) | struct node
type node (line 9) | struct node
type node (line 10) | struct node
function merge (line 14) | void merge()
function printlist (line 46) | void printlist(struct node *temp)
function main (line 58) | int main()
FILE: data_structures/linked_list/middle_element_in_list.c
type Node (line 5) | struct Node
function printMiddle (line 12) | void printMiddle(struct Node *head)
function push (line 28) | void push(struct Node **head_ref, int new_data)
function printList (line 44) | void printList(struct Node *ptr)
function main (line 55) | int main()
FILE: data_structures/linked_list/queue_linked_list.c
type node (line 12) | struct node
type queue (line 18) | struct queue
type queue (line 23) | struct queue
function createqueue (line 27) | void createqueue() { q.front = q.rear = NULL; }
function empty (line 29) | int empty()
function insert (line 37) | void insert(int x)
function removes (line 60) | int removes()
function show (line 80) | void show()
function destroyqueue (line 101) | void destroyqueue() { q.front = q.rear = NULL; }
function main (line 103) | int main()
FILE: data_structures/linked_list/singly_link_list_deletion.c
type node (line 9) | struct node
type node (line 14) | struct node
type node (line 16) | struct node
type node (line 18) | struct node
type node (line 19) | struct node
type node (line 19) | struct node
function insert (line 23) | int insert(int pos, int d)
function deletion (line 64) | int deletion(int pos) // function to delete from any position
function viewlist (line 100) | void viewlist() // function to display values
function test (line 118) | static void test()
function main (line 130) | int main()
FILE: data_structures/linked_list/stack_using_linked_lists.c
type node (line 3) | struct node
type node (line 8) | struct node
type node (line 9) | struct node
type node (line 10) | struct node
type node (line 11) | struct node
function main (line 13) | int main()
function push (line 39) | void push(struct node *p)
function pop (line 53) | void pop(struct node *p)
function display (line 70) | void display(struct node *p)
FILE: data_structures/list/list.c
function L (line 11) | L List_init(void)
function L (line 20) | L List_push(L list, void *val)
function List_length (line 29) | int List_length(L list)
function L (line 52) | L List_list(L list, void *val, ...)
function L (line 70) | L List_append(L list, L tail)
FILE: data_structures/list/list.h
type L (line 5) | struct L
type L (line 7) | struct L
FILE: data_structures/list/main.c
function print_list (line 7) | void print_list(char **array)
function main (line 14) | int main()
FILE: data_structures/queue/include.h
type node (line 13) | struct node
FILE: data_structures/queue/queue.c
function main (line 12) | int main(int argc, char const *argv[])
function create (line 20) | void create()
function enque (line 29) | void enque(int x)
function deque (line 50) | int deque()
function size (line 73) | int size() { return count; }
FILE: data_structures/stack.c
type node (line 19) | struct node
function main (line 42) | int main(int argc, char const *argv[])
function create (line 77) | void create() { head = NULL; }
function push (line 82) | void push(int x)
function pop (line 106) | int pop()
function peek (line 136) | int peek()
function size (line 150) | int size() { return count; }
function isEmpty (line 155) | int isEmpty()
FILE: data_structures/stack/dynamic_stack.c
type DArrayStack (line 24) | typedef struct DArrayStack
function DArrayStack (line 36) | DArrayStack *create_stack(int cap)
function DArrayStack (line 55) | DArrayStack *double_array(DArrayStack *ptr, int cap)
function DArrayStack (line 79) | DArrayStack *shrink_array(DArrayStack *ptr, int cap)
function push (line 101) | int push(DArrayStack *ptr, int data)
function pop (line 124) | int pop(DArrayStack *ptr)
function peek (line 152) | int peek(DArrayStack *ptr)
function show_capacity (line 168) | int show_capacity(DArrayStack *ptr) { return ptr->capacity; }
function isempty (line 177) | int isempty(DArrayStack *ptr)
function stack_size (line 193) | int stack_size(DArrayStack *ptr) { return ptr->top + 1; }
function test (line 199) | static void test()
function main (line 246) | int main()
FILE: data_structures/stack/main.c
function main (line 12) | int main()
function push (line 52) | void push()
function pop (line 62) | void pop()
function peek (line 78) | void peek()
function update (line 87) | void update()
function display (line 104) | void display()
FILE: data_structures/stack/parenthesis.c
type node (line 8) | struct node
type node (line 15) | struct node
function push (line 17) | void push(char x) // function for pushing
function pop (line 39) | char pop(void) // function for pop
function isBalanced (line 50) | int isBalanced(char *s)
function destroyStack (line 82) | void destroyStack(void)
function main (line 98) | int main(void)
FILE: data_structures/stack/stack.c
function initStack (line 34) | void initStack()
function grow (line 44) | void grow()
function push (line 62) | void push(void *object)
function size (line 112) | int size() { return counter; }
function isEmpty (line 117) | int isEmpty() { return counter == 0; }
FILE: data_structures/stack/stack_linked_list/main.c
function main (line 6) | int main()
FILE: data_structures/stack/stack_linked_list/stack.c
type elem_t (line 9) | typedef struct elem
type T (line 15) | struct T
function T (line 22) | T Stack_init(void)
function Stack_empty (line 32) | int Stack_empty(T stack)
function Stack_size (line 39) | int Stack_size(T stack)
function Stack_push (line 46) | void Stack_push(T stack, void *val)
function Stack_print (line 75) | void Stack_print(Stack_T stack)
FILE: data_structures/stack/stack_linked_list/stack.h
type T (line 5) | struct T
FILE: data_structures/trie/trie.c
type trie (line 17) | struct trie {
function trie_new (line 24) | int trie_new (
function trie_insert (line 38) | int trie_insert (
function trie_search (line 85) | int trie_search(
function trie_print (line 123) | void trie_print (
function main (line 157) | int main() {
FILE: data_structures/vector.c
type Vector (line 12) | typedef struct {
function init (line 25) | void init(Vector* vec, int val) {
function delete (line 37) | void delete(Vector* vec) {
function clear (line 46) | void clear(Vector* vec) {
function len (line 56) | int len(Vector* vec) {
function push (line 66) | void push(Vector* vec, int val) {
function get (line 78) | int get(Vector* vec, int index) {
function set (line 91) | void set(Vector* vec, int index, int val) {
function next (line 102) | int next(Vector* vec) {
function print (line 125) | void print(Vector* vec) {
function test (line 138) | static void test() {
function main (line 156) | int main() {
FILE: developer_tools/malloc_dbg.c
type mem_info (line 20) | typedef struct MEMORY_INFORMATION
function mem_info (line 51) | mem_info* addMemInfo(mem_info* memoryInfo, void* ptrToReturn, size_t byt...
function inList (line 79) | int inList(const char* filename, int line)
function editInfo (line 107) | void editInfo(int elemPos, size_t bytes)
function free_dbg (line 208) | void free_dbg(void* ptrToFree)
function printLeaks (line 264) | void printLeaks()
FILE: developer_tools/min_printf.h
type Buffer (line 35) | typedef struct buffer {
function power_of_ten (line 48) | int power_of_ten(int a)
function is_number (line 62) | int is_number(char *c)
function get_ch (line 74) | char get_ch(char *p, Buffer *buffer)
function unget_ch (line 88) | void unget_ch(char *c, Buffer *buffer)
function get_number_of_digits (line 100) | int get_number_of_digits(int n)
function put_char (line 114) | void put_char(char s)
function reverse_str (line 128) | void reverse_str(char *p)
function print_int_value (line 158) | void print_int_value(int n, int width, int precision)
function print_double_value (line 210) | void print_double_value(double dval, int width, int precision)
function print_string (line 238) | void print_string(char *p, int width, int precision)
function min_printf (line 299) | void min_printf(char *fmt, ...)
FILE: developer_tools/test_malloc_dbg.c
function main (line 22) | int main(int argc, char* argv[])
FILE: developer_tools/test_min_printf.c
function main (line 24) | int main()
FILE: dynamic_programming/lcs.c
function lcslen (line 30) | void lcslen(const char *s1, const char *s2, int l1, int l2, int **L, int...
function test (line 100) | static void test() {
function main (line 162) | int main(int argc, char *argv[]) {
FILE: dynamic_programming/matrix_chain_order.c
function matrixChainOrder (line 26) | int matrixChainOrder(int l, const int *p, int *s)
function printSolution (line 79) | void printSolution(int l, int *s, int i, int j)
function test (line 96) | static void test()
function main (line 115) | int main()
FILE: exercism/isogram/isogram.c
function is_isogram (line 7) | bool is_isogram(const char phrase[])
FILE: exercism/word_count/word_count.c
function word_count (line 14) | int word_count(const char *input_text, word_count_word_t *words)
FILE: exercism/word_count/word_count.h
type word_count_word_t (line 8) | typedef struct word_count_word
FILE: games/hangman.c
type game_instance (line 19) | struct game_instance{
type game_instance (line 31) | struct game_instance
function main (line 41) | int main() {
function new_guess (line 99) | int new_guess(char new_guess, const char guesses[], int size) {
function in_word (line 119) | int in_word(char letter, const char word[], unsigned int size) {
function new_game (line 134) | struct game_instance new_game() {
function won (line 192) | void won(const char word[], int score) {
function picture (line 206) | void picture(int score) {
FILE: games/naval_battle.c
function validEntryLineColumn (line 25) | int validEntryLineColumn(int line, char column)
function validatePosition (line 43) | int validatePosition(int mat[10][10], int boat, int line, int column,
function canShoot (line 107) | int canShoot(int mat[10][10], int line, int column)
function positionBoat (line 124) | void positionBoat(int mat[10][10], int boat)
function printMessage (line 266) | void printMessage(char *msg)
function printMessageScore (line 280) | void printMessageScore(int pts1, int pts2)
function printTable (line 296) | char printTable(int logic, int stage)
function printsTray (line 355) | void printsTray(int mat[10][10], int stage)
function shoot (line 411) | void shoot(int mat[10][10], int line, int column)
function calculateScore (line 442) | int calculateScore(int mat[10][10], int line, int column)
function printPositioning (line 652) | void printPositioning(int Player, int boat, int nm)
function main (line 813) | int main()
FILE: games/tic_tac_toe.c
function main (line 37) | int main()
function singlemode (line 85) | void singlemode()
function doublemode (line 156) | void doublemode()
function check_placex (line 223) | int check_placex(){
function placex (line 255) | void placex(int m)
function place (line 281) | void place()
function placey (line 306) | void placey(int e1)
function checkwin (line 334) | int checkwin()
FILE: geometry/geometry_datatypes.h
type vec_3d (line 21) | typedef struct vec_3d_
type mat_3x3 (line 34) | typedef struct mat_3x3_
type quaternion (line 60) | typedef struct quaternion_
type euler (line 80) | typedef struct euler_
type dual_quat (line 105) | typedef struct dual_quat_
FILE: geometry/quaternions.c
function quaternion (line 47) | quaternion quat_from_euler(const euler *in_euler)
function euler (line 88) | euler euler_from_quat(const quaternion *in_quat)
function quaternion (line 129) | quaternion quaternion_multiply(const quaternion *in_quat1,
function test (line 153) | static void test()
function main (line 169) | int main()
FILE: geometry/vectors_3d.c
function vec_3d (line 31) | vec_3d vector_sub(const vec_3d *a, const vec_3d *b)
function vec_3d (line 53) | vec_3d vector_add(const vec_3d *a, const vec_3d *b)
function dot_prod (line 76) | float dot_prod(const vec_3d *a, const vec_3d *b)
function vec_3d (line 105) | vec_3d vector_prod(const vec_3d *a, const vec_3d *b)
function vector_norm (line 138) | float vector_norm(const vec_3d *a)
function vec_3d (line 156) | vec_3d unit_vec(const vec_3d *a)
function mat_3x3 (line 188) | mat_3x3 get_cross_matrix(const vec_3d *a)
function get_angle (line 202) | double get_angle(const vec_3d *a, const vec_3d *b)
function test (line 223) | static void test()
function main (line 260) | int main(void)
FILE: graphics/spirograph.c
function spirograph (line 57) | void spirograph(double *x, double *y, double l, double k, size_t N, doub...
function test (line 74) | void test(void)
function glutBitmapString (line 124) | static inline void glutBitmapString(void *font, char *string)
function display_graph (line 136) | void display_graph(const double *x, const double *y, size_t N, double l,
function test2 (line 172) | void test2(void)
function timer_cb (line 228) | void timer_cb(int id)
function keyboard_cb (line 241) | void keyboard_cb(unsigned char key, int x, int y)
function main (line 271) | int main(int argc, char **argv)
FILE: greedy_approach/dijkstra.c
function enqueue (line 15) | void enqueue(int v) { q[qp++] = v; }
function cf (line 17) | int cf(void *a, void *b)
function dequeue (line 24) | int dequeue()
function queue_has_something (line 30) | int queue_has_something() { return (qp > 0); }
function dijkstra (line 35) | void dijkstra(int s)
function main (line 64) | int main(int argc, char const *argv[])
FILE: greedy_approach/prim.c
function minimum (line 45) | uint16_t minimum(uint16_t arr[], uint16_t N)
function prim (line 65) | void prim(uint16_t G[][MAX], uint16_t MST[][MAX], uint16_t V)
function test (line 113) | static void test(uint16_t G[][MAX], uint16_t MST[][MAX], uint16_t V)
function user_graph (line 145) | void user_graph(uint16_t G[][MAX], uint16_t MST[][MAX], uint16_t V)
function main (line 185) | int main(int argc, char const *argv[])
FILE: hash/hash_adler32.c
function adler32 (line 18) | uint32_t adler32(const char* s)
function test_adler32 (line 38) | void test_adler32()
function main (line 50) | int main()
FILE: hash/hash_blake2b.c
function u128_fill (line 120) | static inline void u128_fill(u128 dest, size_t n)
function u128_increment (line 147) | static inline void u128_increment(u128 dest, uint64_t n)
function G (line 175) | static void G(block_t v, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uin...
function F (line 203) | static void F(uint64_t h[8], block_t m, u128 t, int f)
function BLAKE2B (line 286) | static int BLAKE2B(uint8_t *dest, block_t *d, size_t dd, u128 ll, uint8_...
function assert_bytes (line 432) | static void assert_bytes(const uint8_t *expected, const uint8_t *actual,
function test (line 452) | static void test()
function main (line 547) | int main()
FILE: hash/hash_crc32.c
function crc32 (line 20) | uint32_t crc32(const char* s)
function test_crc32 (line 42) | void test_crc32()
function main (line 54) | int main()
FILE: hash/hash_djb2.c
function djb2 (line 18) | uint64_t djb2(const char* s)
function test_djb2 (line 34) | void test_djb2(void)
function main (line 46) | int main()
FILE: hash/hash_sdbm.c
function sdbm (line 18) | uint64_t sdbm(const char* s)
function test_sdbm (line 34) | void test_sdbm()
function main (line 46) | int main()
FILE: hash/hash_xor8.c
function xor8 (line 19) | uint8_t xor8(const char* s)
function test_xor8 (line 35) | void test_xor8()
function main (line 47) | int main()
FILE: leetcode/src/10.c
function matchStar (line 38) | bool matchStar(char ch, char* s, char* p) {
function isMatch (line 47) | bool isMatch(char* s, char* p) {
FILE: leetcode/src/1008.c
type TreeNode (line 10) | struct TreeNode
type TreeNode (line 12) | struct TreeNode
type TreeNode (line 15) | struct TreeNode
FILE: leetcode/src/1009.c
function bitwiseComplement (line 8) | int bitwiseComplement(int n){
FILE: leetcode/src/101.c
function checkSymmetric (line 10) | bool checkSymmetric(struct TreeNode *left, struct TreeNode *right)
function isSymmetric (line 20) | bool isSymmetric(struct TreeNode *root)
FILE: leetcode/src/1019.c
type ListNode (line 9) | struct ListNode
type ListNode (line 12) | struct ListNode
FILE: leetcode/src/1026.c
function recursiveSolve (line 13) | void recursiveSolve(struct TreeNode* node, int* result, int minVal, int ...
function maxAncestorDiff (line 32) | int maxAncestorDiff(struct TreeNode* root){
FILE: leetcode/src/104.c
function maxval (line 10) | int maxval(int a, int b)
function maxDepth (line 17) | int maxDepth(struct TreeNode *root)
FILE: leetcode/src/108.c
type TreeNode (line 10) | struct TreeNode
type TreeNode (line 17) | struct TreeNode
type TreeNode (line 17) | struct TreeNode
type TreeNode (line 25) | struct TreeNode
FILE: leetcode/src/1089.c
function duplicateZeros (line 1) | void duplicateZeros(int *arr, int arrSize)
FILE: leetcode/src/109.c
type TreeNode (line 1) | struct TreeNode
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
type ListNode (line 5) | struct ListNode
type TreeNode (line 11) | struct TreeNode
type TreeNode (line 11) | struct TreeNode
type TreeNode (line 17) | struct TreeNode
type ListNode (line 17) | struct ListNode
FILE: leetcode/src/11.c
function min (line 2) | int min(int a, int b) { return ((a < b) ? a : b); }
function maxArea (line 5) | int maxArea(int *height, int heightSize)
FILE: leetcode/src/110.c
function max (line 1) | int max(int a, int b) { return a >= b ? a : b; }
function height (line 3) | int height(struct TreeNode *root)
function isBalanced (line 11) | bool isBalanced(struct TreeNode *root)
FILE: leetcode/src/112.c
function hasPathSum (line 1) | bool hasPathSum(struct TreeNode *root, int sum)
FILE: leetcode/src/1137.c
function tribonacci (line 4) | int tribonacci(int n){
FILE: leetcode/src/1147.c
function equalSubstrings (line 3) | bool equalSubstrings(char* text, int firstIndex, int secondIndex, int le...
function longestDecompositionDpCached (line 13) | int longestDecompositionDpCached(char* text, int textLen, int index, int...
function longestDecompositionDp (line 25) | int longestDecompositionDp(char* text, int textLen, int index, int* dp){
function longestDecomposition (line 42) | int longestDecomposition(char * text){
FILE: leetcode/src/1184.c
function distanceBetweenBusStops (line 1) | int distanceBetweenBusStops(int *distance, int distanceSize, int start,
FILE: leetcode/src/1189.c
function maxNumberOfBalloons (line 1) | int maxNumberOfBalloons(char *text)
FILE: leetcode/src/1207.c
function cmpvalue (line 3) | int cmpvalue(const void *a, const void *b) { return *(int *)b - *(int *)...
function uniqueOccurrences (line 4) | bool uniqueOccurrences(int *arr, int arrSize)
FILE: leetcode/src/121.c
function maxcmp (line 1) | int maxcmp(int a, int b) { return (a >= b) ? a : b; }
function maxProfit (line 5) | int maxProfit(int *prices, int pricesSize)
FILE: leetcode/src/124.c
function recursiveSolve (line 12) | int recursiveSolve(struct TreeNode* node, int* result){
function maxPathSum (line 31) | int maxPathSum(struct TreeNode* root){
FILE: leetcode/src/125.c
function isPalindrome (line 1) | bool isPalindrome(char *s)
FILE: leetcode/src/1283.c
function getSum (line 3) | long getSum(int* nums, int numsSize, int divizor){
function smallestDivisor (line 20) | int smallestDivisor(int* nums, int numsSize, int threshold){
FILE: leetcode/src/13.c
function romanToInt (line 1) | int romanToInt(char *s)
FILE: leetcode/src/136.c
function singleNumber (line 1) | int singleNumber(int *nums, int numsSize)
FILE: leetcode/src/14.c
function findMaxConsecutiveOnes (line 1) | int findMaxConsecutiveOnes(int* nums, int numsSize){
FILE: leetcode/src/141.c
function hasCycle (line 8) | bool hasCycle(struct ListNode *head)
FILE: leetcode/src/142.c
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
type ListNode (line 5) | struct ListNode
type ListNode (line 13) | struct ListNode
FILE: leetcode/src/1524.c
function numOfSubarrays (line 4) | int numOfSubarrays(int* arr, int arrSize){
FILE: leetcode/src/153.c
function findMin (line 1) | int findMin(int *nums, int numsSize)
FILE: leetcode/src/16.c
function cmp (line 3) | int cmp(const void* a, const void* b) {
function threeSumClosest (line 8) | int threeSumClosest(int* nums, int nums_size, int target) {
FILE: leetcode/src/160.c
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
type ListNode (line 2) | struct ListNode
type ListNode (line 4) | struct ListNode
FILE: leetcode/src/1653.c
function minimumDeletions (line 6) | int minimumDeletions(char * s){
FILE: leetcode/src/1657.c
function diff (line 13) | int diff(const int *i, const int *j)
function closeStrings (line 21) | bool closeStrings(char * word1, char * word2){
FILE: leetcode/src/169.c
function majorityElement (line 3) | int majorityElement(int *nums, int numsSize)
FILE: leetcode/src/1695.c
function maximumUniqueSubarray (line 2) | int maximumUniqueSubarray(int* nums, int numsSize){
FILE: leetcode/src/1704.c
function isVowel (line 1) | bool isVowel(char chr){
function halvesAreAlike (line 22) | bool halvesAreAlike(char * s){
FILE: leetcode/src/173.c
type BSTIterator (line 12) | typedef struct
function TraverseAndAssign (line 19) | void TraverseAndAssign(struct TreeNode *root, BSTIterator *obj)
function TotalNodes (line 31) | int TotalNodes(struct TreeNode *root)
function BSTIterator (line 40) | BSTIterator *bSTIteratorCreate(struct TreeNode *root)
function bSTIteratorNext (line 56) | int bSTIteratorNext(BSTIterator *obj)
function bSTIteratorHasNext (line 64) | bool bSTIteratorHasNext(BSTIterator *obj)
function bSTIteratorFree (line 74) | void bSTIteratorFree(BSTIterator *obj)
FILE: leetcode/src/1752.c
function check (line 1) | bool check(int* nums, int numsSize){
FILE: leetcode/src/1833.c
function compare (line 1) | int compare(const void* i, const void* j)
function maxIceCream (line 9) | int maxIceCream(int* costs, int costsSize, int coins){
FILE: leetcode/src/1838.c
function compare (line 3) | int compare(const int* i, const int* j)
function maxFrequency (line 11) | int maxFrequency(int* nums, int numsSize, int k){
FILE: leetcode/src/189.c
function rotate (line 1) | void rotate(int *nums, int numsSize, int k)
FILE: leetcode/src/19.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 10) | struct ListNode
FILE: leetcode/src/190.c
function reverseBits (line 1) | uint32_t reverseBits(uint32_t n)
FILE: leetcode/src/191.c
function hammingWeight (line 1) | int hammingWeight(uint32_t n)
FILE: leetcode/src/2.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 11) | struct ListNode
type ListNode (line 12) | struct ListNode
type ListNode (line 13) | struct ListNode
type ListNode (line 41) | struct ListNode
FILE: leetcode/src/20.c
function isValid (line 1) | bool isValid(char *s)
FILE: leetcode/src/201.c
function rangeBitwiseAnd (line 1) | int rangeBitwiseAnd(int m, int n)
FILE: leetcode/src/2024.c
function maximizeTarget (line 3) | int maximizeTarget(char * answerKey, char targetChar, int k){
function maxConsecutiveAnswers (line 31) | int maxConsecutiveAnswers(char * answerKey, int k){
FILE: leetcode/src/203.c
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
FILE: leetcode/src/206.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 11) | struct ListNode
type ListNode (line 14) | struct ListNode
FILE: leetcode/src/2095.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 13) | struct ListNode
FILE: leetcode/src/21.c
type ListNode (line 4) | struct ListNode
type ListNode (line 4) | struct ListNode
type ListNode (line 4) | struct ListNode
type ListNode (line 6) | struct ListNode
type ListNode (line 7) | struct ListNode
type ListNode (line 56) | struct ListNode
type ListNode (line 56) | struct ListNode
type ListNode (line 56) | struct ListNode
FILE: leetcode/src/2125.c
function coundDevices (line 1) | int coundDevices(char* bankRow){
function numberOfBeams (line 16) | int numberOfBeams(char ** bank, int bankSize){
FILE: leetcode/src/2130.c
function pairSum (line 9) | int pairSum(struct ListNode* head)
FILE: leetcode/src/215.c
function findKthLargest (line 3) | int findKthLargest(int *nums, int numsSize, int k)
FILE: leetcode/src/217.c
function numcmp (line 1) | int numcmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
function containsDuplicate (line 3) | bool containsDuplicate(int *nums, int numsSize)
FILE: leetcode/src/2222.c
function numberOfWaysForChar (line 1) | long numberOfWaysForChar(char * s, char c){
function numberOfWays (line 28) | long long numberOfWays(char * s){
FILE: leetcode/src/223.c
function intersectionSize (line 3) | int intersectionSize(int p11, int p12, int p21, int p22){
function computeArea (line 18) | int computeArea(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, in...
FILE: leetcode/src/2256.c
function minimumAverageDifference (line 8) | int minimumAverageDifference(int* nums, int numsSize){
FILE: leetcode/src/226.c
type TreeNode (line 1) | struct TreeNode
type TreeNode (line 1) | struct TreeNode
type TreeNode (line 3) | struct TreeNode
FILE: leetcode/src/2270.c
function waysToSplitArray (line 5) | int waysToSplitArray(int* nums, int numsSize){
FILE: leetcode/src/2279.c
function compare (line 1) | int compare(const int* i, const int* j)
function maximumBags (line 9) | int maximumBags(int* capacity, int capacitySize, int* rocks, int rocksSi...
FILE: leetcode/src/230.c
type TreeNode (line 10) | struct TreeNode
type TreeNode (line 10) | struct TreeNode
type TreeNode (line 15) | struct TreeNode
function kthSmallest (line 33) | int kthSmallest(struct TreeNode* root, int k){
FILE: leetcode/src/2304.c
function minPathCost (line 7) | int minPathCost(int** grid, int gridSize, int* gridColSize, int** moveCo...
FILE: leetcode/src/231.c
function isPowerOfTwo (line 4) | bool isPowerOfTwo(int n){
FILE: leetcode/src/234.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 11) | struct ListNode
type ListNode (line 14) | struct ListNode
function isPalindrome (line 21) | bool isPalindrome(struct ListNode *head)
FILE: leetcode/src/236.c
type ListItem (line 11) | struct ListItem {
function findTargetPath (line 16) | bool findTargetPath(struct TreeNode* node, struct TreeNode* target, stru...
function freeList (line 43) | void freeList(struct ListItem* target){
type TreeNode (line 57) | struct TreeNode
type TreeNode (line 57) | struct TreeNode
type TreeNode (line 57) | struct TreeNode
type TreeNode (line 57) | struct TreeNode
type ListItem (line 58) | struct ListItem
type ListItem (line 58) | struct ListItem
type ListItem (line 59) | struct ListItem
type ListItem (line 59) | struct ListItem
type TreeNode (line 64) | struct TreeNode
type ListItem (line 65) | struct ListItem
type ListItem (line 66) | struct ListItem
FILE: leetcode/src/24.c
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
type ListNode (line 5) | struct ListNode
FILE: leetcode/src/242.c
function isAnagram (line 1) | bool isAnagram(char *s, char *t)
FILE: leetcode/src/2501.c
function longestSquareStreakDp (line 3) | int longestSquareStreakDp(int* numsSet, int numsSetSize, int* dp, long n...
function longestSquareStreak (line 21) | int longestSquareStreak(int* nums, int numsSize){
FILE: leetcode/src/26.c
function removeDuplicates (line 1) | int removeDuplicates(int *nums, int numsSize)
FILE: leetcode/src/268.c
function missingNumber (line 1) | int missingNumber(int *nums, int numsSize)
FILE: leetcode/src/27.c
function removeElement (line 1) | int removeElement(int *nums, int numsSize, int val)
FILE: leetcode/src/274.c
function diff (line 1) | int diff(const int* i, const int* j)
function hIndex (line 11) | int hIndex(int* citations, int citationsSize){
FILE: leetcode/src/278.c
function firstBadVersion (line 4) | int firstBadVersion(int n)
FILE: leetcode/src/28.c
function strStr (line 5) | int strStr(char *haystack, char *needle)
function fill_overlap (line 57) | void fill_overlap(char *needle, int len_needle, int *overlap)
function strStr (line 81) | int strStr(char *haystack, char *needle)
FILE: leetcode/src/283.c
function moveZeroes (line 1) | void moveZeroes(int *nums, int numsSize)
FILE: leetcode/src/287.c
function cmpval (line 1) | int cmpval(const void *a, const void *b) { return *(int *)a - *(int *)b; }
function findDuplicate (line 2) | int findDuplicate(int *nums, int numsSize)
FILE: leetcode/src/29.c
function divide (line 1) | int divide(int dividend, int divisor)
FILE: leetcode/src/3.c
function lengthOfLongestSubstring (line 1) | int lengthOfLongestSubstring(char *str)
function lengthOfLongestSubstring (line 37) | int lengthOfLongestSubstring(char *s)
FILE: leetcode/src/32.c
function getEndValidIndexFromDp (line 6) | int getEndValidIndexFromDp(int* dp, char* s, int index, int lenS){
function getEndValidIndex (line 18) | int getEndValidIndex(int* dp, char* s, int index, int lenS){
function longestValidParentheses (line 42) | int longestValidParentheses(char * s){
FILE: leetcode/src/344.c
function reverseString (line 1) | void reverseString(char *s, int sSize)
FILE: leetcode/src/35.c
function searchInsert (line 1) | int searchInsert(int *nums, int numsSize, int target)
function searchInsert (line 18) | int searchInsert(int *nums, int numsSize, int target)
FILE: leetcode/src/367.c
function isPerfectSquare (line 1) | bool isPerfectSquare(int num)
FILE: leetcode/src/37.c
function getTripletId (line 11) | int getTripletId(int i, int j){
function sudokuSolver (line 16) | bool sudokuSolver(int startI, int startJ, char** board, int boardSize, i...
function solveSudoku (line 61) | void solveSudoku(char** board, int boardSize, int* boardColSize){
FILE: leetcode/src/387.c
function firstUniqChar (line 1) | int firstUniqChar(char *s)
FILE: leetcode/src/389.c
function findTheDifference (line 1) | char findTheDifference(char *s, char *t)
FILE: leetcode/src/4.c
function findMedianSortedArrays (line 3) | double findMedianSortedArrays(int *nums1, int nums1Size, int *nums2,
FILE: leetcode/src/404.c
function isleaf (line 1) | bool isleaf(struct TreeNode *root)
function sumOfLeftLeaves (line 6) | int sumOfLeftLeaves(struct TreeNode *root)
FILE: leetcode/src/42.c
function trap (line 10) | int trap(int* height, int heightSize){
FILE: leetcode/src/434.c
function countSegments (line 2) | int countSegments(char * s){
FILE: leetcode/src/442.c
function cmpval (line 1) | int cmpval(const void *a, const void *b) { return *(int *)a - *(int *)b; }
FILE: leetcode/src/45.c
function jump (line 4) | int jump(int* nums, int numsSize) {
FILE: leetcode/src/461.c
function hammingDistance (line 1) | int hammingDistance(int x, int y)
FILE: leetcode/src/476.c
function findComplement (line 1) | int findComplement(int num)
FILE: leetcode/src/485.c
function max (line 1) | int max(a,b){
function findMaxConsecutiveOnes (line 8) | int findMaxConsecutiveOnes(int* nums, int numsSize){
FILE: leetcode/src/50.c
function powPositive (line 1) | double powPositive(double x, int n){
function myPow (line 20) | double myPow(double x, int n){
FILE: leetcode/src/509.c
function fib (line 1) | int fib(int N)
FILE: leetcode/src/520.c
function detectCapitalUse (line 1) | bool detectCapitalUse(char *word)
function isAllUpper (line 24) | bool isAllUpper(char *word)
function detectCapitalUse (line 34) | bool detectCapitalUse(char *word)
FILE: leetcode/src/53.c
function maxcmp (line 2) | int maxcmp(int a, int b) { return a >= b ? a : b; }
function maxSubArray (line 4) | int maxSubArray(int *nums, int numsSize)
FILE: leetcode/src/540.c
function singleNonDuplicate (line 14) | int singleNonDuplicate(int* nums, int numsSize) {
FILE: leetcode/src/561.c
function cmpval (line 1) | int cmpval(const void *a, const void *b) { return *(int *)a - *(int *)b; }
function arrayPairSum (line 2) | int arrayPairSum(int *nums, int numsSize)
FILE: leetcode/src/567.c
function countCharsForStringSlice (line 3) | void countCharsForStringSlice(int* charsCounter, char* s, int length, in...
function checkInclusion (line 14) | bool checkInclusion(char* s1, char* s2) {
FILE: leetcode/src/6.c
function testZigZag (line 86) | static void testZigZag(char* s, int numRows, char* expected)
function test (line 100) | static void test()
function main (line 147) | int main(void)
FILE: leetcode/src/617.c
type TreeNode (line 1) | struct TreeNode
type TreeNode (line 3) | struct TreeNode
type TreeNode (line 3) | struct TreeNode
type TreeNode (line 3) | struct TreeNode
type TreeNode (line 9) | struct TreeNode
type TreeNode (line 9) | struct TreeNode
type TreeNode (line 9) | struct TreeNode
type TreeNode (line 14) | struct TreeNode
FILE: leetcode/src/62.c
function uniquePaths (line 17) | int uniquePaths(int m, int n)
FILE: leetcode/src/63.c
function uniquePathsWithObstacles (line 13) | int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize,
FILE: leetcode/src/647.c
function countSubstrings (line 4) | int countSubstrings(char *s)
function countPalin (line 19) | int countPalin(char *s, int head, int tail, int len)
FILE: leetcode/src/669.c
type TreeNode (line 14) | struct TreeNode
type TreeNode (line 14) | struct TreeNode
FILE: leetcode/src/674.c
function findLengthOfLCIS (line 1) | int findLengthOfLCIS(int *nums, int numsSize)
FILE: leetcode/src/684.c
function find (line 4) | int find(int* sets, int index){
function unionSet (line 12) | void unionSet(int* sets, int i1, int i2){
FILE: leetcode/src/69.c
function mySqrt (line 2) | int mySqrt(int x){
FILE: leetcode/src/7.c
function reverse (line 3) | int reverse(int x)
FILE: leetcode/src/700.c
type TreeNode (line 10) | struct TreeNode
type TreeNode (line 10) | struct TreeNode
FILE: leetcode/src/701.c
type TreeNode (line 1) | struct TreeNode
type TreeNode (line 1) | struct TreeNode
type TreeNode (line 5) | struct TreeNode
type TreeNode (line 5) | struct TreeNode
FILE: leetcode/src/704.c
function search (line 1) | int search(int *nums, int numsSize, int target)
function cmpint (line 24) | int cmpint(const void *a, const void *b) { return *(int *)a - *(int *)b; }
function search (line 26) | int search(int *nums, int numsSize, int target)
FILE: leetcode/src/75.c
function swap (line 1) | void swap(int *x, int *y){
function sortColors (line 9) | void sortColors(int* arr, int n){
FILE: leetcode/src/771.c
function numJewelsInStones (line 4) | int numJewelsInStones(char *j, char *s)
FILE: leetcode/src/79.c
function getPointKey (line 1) | int getPointKey(int i, int j, int boardSize, int boardColSize){
function exitsWord (line 8) | bool exitsWord(int i, int j, char** board, int boardSize, int* boardColS...
function exist (line 44) | bool exist(char** board, int boardSize, int* boardColSize, char* word){
FILE: leetcode/src/8.c
function myAtoi (line 1) | int myAtoi(char *str)
FILE: leetcode/src/807.c
function maxIncreaseKeepingSkyline (line 7) | int maxIncreaseKeepingSkyline(int** grid, int gridSize, int* gridColSize){
FILE: leetcode/src/82.c
type ListNode (line 1) | struct ListNode
type ListNode (line 1) | struct ListNode
FILE: leetcode/src/83.c
type ListNode (line 2) | struct ListNode
type ListNode (line 2) | struct ListNode
type ListNode (line 4) | struct ListNode
FILE: leetcode/src/841.c
function visitRooms (line 1) | void visitRooms(int key, int** rooms, int roomsSize, int* roomsColSize, ...
function canVisitAllRooms (line 15) | bool canVisitAllRooms(int** rooms, int roomsSize, int* roomsColSize){
FILE: leetcode/src/852.c
function peakIndexInMountainArray (line 1) | int peakIndexInMountainArray(int *A, int ASize)
FILE: leetcode/src/876.c
type ListNode (line 9) | struct ListNode
type ListNode (line 9) | struct ListNode
type ListNode (line 11) | struct ListNode
FILE: leetcode/src/9.c
function isPalindrome (line 1) | bool isPalindrome(int x)
FILE: leetcode/src/901.c
type Stack (line 6) | typedef struct stack{
type StockSpanner (line 13) | typedef struct {
function StockSpanner (line 20) | StockSpanner* stockSpannerCreate() {
function stockSpannerNext (line 29) | int stockSpannerNext(StockSpanner* obj, int price) {
function stockSpannerFree (line 51) | void stockSpannerFree(StockSpanner* obj) {
FILE: leetcode/src/931.c
function minFallingPathSum (line 6) | int minFallingPathSum(int** matrix, int matrixSize, int* matrixColSize){
FILE: leetcode/src/938.c
function rangeSumBST (line 1) | int rangeSumBST(struct TreeNode *root, int L, int R)
FILE: leetcode/src/94.c
function processTraversal (line 1) | void processTraversal(struct TreeNode *root, int *res, int *size)
type TreeNode (line 11) | struct TreeNode
FILE: leetcode/src/953.c
function isWordLess (line 3) | bool isWordLess(char* word1, char* word2, int* charOrder){
function isAlienSorted (line 25) | bool isAlienSorted(char ** words, int wordsSize, char * order){
FILE: leetcode/src/965.c
function isUnivalTree (line 1) | bool isUnivalTree(struct TreeNode *root)
FILE: leetcode/src/977.c
function cmpval (line 24) | int cmpval(const void *a, const void *b) { return *(int *)a - *(int *)b; }
FILE: leetcode/src/979.c
type NodeDistributeInfo (line 10) | struct NodeDistributeInfo {
type NodeDistributeInfo (line 15) | struct NodeDistributeInfo
type TreeNode (line 15) | struct TreeNode
type NodeDistributeInfo (line 16) | struct NodeDistributeInfo
type NodeDistributeInfo (line 16) | struct NodeDistributeInfo
type NodeDistributeInfo (line 24) | struct NodeDistributeInfo
type NodeDistributeInfo (line 25) | struct NodeDistributeInfo
function distributeCoins (line 45) | int distributeCoins(struct TreeNode* root) {
FILE: leetcode/src/98.c
function checkIsBst (line 13) | bool checkIsBst(struct TreeNode* node, bool leftBoundInf, int leftBound,...
function isValidBST (line 22) | bool isValidBST(struct TreeNode* root){
FILE: leetcode/src/997.c
function findJudge (line 4) | int findJudge(int n, int** trust, int trustSize, int* trustColSize){
FILE: machine_learning/adaline_learning.c
type adaline (line 43) | struct adaline
function new_adaline (line 59) | struct adaline new_adaline(const int num_features, const double eta)
function delete_adaline (line 89) | void delete_adaline(struct adaline *ada)
function adaline_activation (line 105) | int adaline_activation(double x) { return x > 0 ? 1 : -1; }
type adaline (line 112) | struct adaline
function adaline_predict (line 136) | int adaline_predict(struct adaline *ada, const double *x, double *out)
function adaline_fit_sample (line 158) | double adaline_fit_sample(struct adaline *ada, const double *x, const in...
function adaline_fit (line 184) | void adaline_fit(struct adaline *ada, double **X, const int *y, const in...
function test1 (line 225) | void test1(double eta)
function test2 (line 273) | void test2(double eta)
function test3 (line 336) | void test3(double eta)
function main (line 398) | int main(int argc, char **argv)
FILE: machine_learning/k_means_clustering.c
type observation (line 38) | typedef struct observation
type cluster (line 52) | typedef struct cluster
function calculateNearst (line 69) | int calculateNearst(observation* o, cluster clusters[], int k)
function calculateCentroid (line 97) | void calculateCentroid(observation observations[], size_t size,
function cluster (line 134) | cluster* kMeans(observation observations[], size_t size, int k)
function printEPS (line 237) | void printEPS(observation pts[], size_t len, cluster cent[], int k)
function test (line 321) | static void test()
function test2 (line 356) | void test2()
function main (line 384) | int main()
FILE: machine_learning/kohonen_som_topology.c
type kohonen_array_3d (line 47) | struct kohonen_array_3d
type kohonen_array_3d (line 67) | struct kohonen_array_3d
function _random (line 87) | double _random(double a, double b)
function save_2d_data (line 102) | int save_2d_data(const char *fname, double **X, int num_points,
function save_u_matrix (line 139) | int save_u_matrix(const char *fname, struct kohonen_array_3d *W)
function get_min_2d (line 204) | void get_min_2d(double **X, int N, double *val, int *x_idx, int *y_idx)
function kohonen_update_weights (line 234) | double kohonen_update_weights(const double *X, struct kohonen_array_3d *W,
function kohonen_som (line 314) | void kohonen_som(double **X, struct kohonen_array_3d *W, int num_samples,
function test_2d_classes (line 366) | void test_2d_classes(double *const *data, int N)
function test1 (line 406) | void test1()
function test_3d_classes1 (line 465) | void test_3d_classes1(double *const *data, int N)
function test2 (line 506) | void test2()
function test_3d_classes2 (line 564) | void test_3d_classes2(double *const *data, int N)
function test3 (line 609) | void test3()
function get_clock_diff (line 663) | double get_clock_diff(clock_t start_t, clock_t end_t)
function main (line 669) | int main(int argc, char **argv)
FILE: machine_learning/kohonen_som_trace.c
function _random (line 54) | double _random(double a, double b)
function save_nd_data (line 70) | int save_nd_data(const char *fname, double **X, int num_points,
function kohonen_get_min_1d (line 104) | void kohonen_get_min_1d(double const *X, int N, double *val, int *idx)
function kohonen_update_weights (line 129) | void kohonen_update_weights(double const *x, double *const *W, double *D,
function kohonen_som_tracer (line 179) | void kohonen_som_tracer(double **X, double *const *W, int num_samples,
function test_circle (line 223) | void test_circle(double *const *data, int N)
function test1 (line 261) | void test1()
function test_lamniscate (line 319) | void test_lamniscate(double *const *data, int N)
function test2 (line 358) | void test2()
function test_3d_classes (line 410) | void test_3d_classes(double *const *data, int N)
function test3 (line 462) | void test3()
function get_clock_diff (line 511) | double get_clock_diff(clock_t start_t, clock_t end_t)
function main (line 517) | int main(int argc, char **argv)
FILE: math/armstrong_number.c
function power (line 7) | int power(int x, unsigned int y)
function order (line 17) | int order(int x)
function isArmstrong (line 30) | int isArmstrong(int x)
function main (line 50) | int main()
FILE: math/cantor_set.c
type CantorSet (line 11) | typedef struct _cantor_set
function propagate (line 23) | void propagate(CantorSet *head)
function print (line 55) | void print(CantorSet *head)
function free_memory (line 72) | void free_memory(CantorSet *head)
function main (line 84) | int main(int argc, char const *argv[])
FILE: math/cartesian_to_polar.c
function to_polar (line 22) | void to_polar(double x, double y, double *r, double *theta)
function get_rand (line 88) | double get_rand(double lim1, double lim2)
function test (line 98) | void test()
function main (line 118) | int main()
FILE: math/catalan.c
function factorial (line 5) | long int factorial(int x) // long int for more than 10 factorial
function main (line 16) | int main()
FILE: math/collatz.c
function main (line 16) | int main(int argc, char *argv[])
FILE: math/euclidean_algorithm_extended.c
type euclidean_result_t (line 20) | typedef struct euclidean_result
function xy_push (line 36) | static inline void xy_push(int arr[2], int newval)
function calculate_next_xy (line 54) | static inline void calculate_next_xy(int quotient, int prev[2])
function euclidean_result_t (line 69) | euclidean_result_t extended_euclidean_algorithm(int a, int b)
function single_test (line 121) | static inline void single_test(int a, int b, int gcd, int x, int y)
function test (line 135) | static void test()
function main (line 150) | int main()
FILE: math/factorial.c
function main (line 2) | int main()
FILE: math/factorial_large_number.c
type large_num (line 14) | typedef struct _large_num
function large_num (line 24) | large_num *new_number(void)
function delete_number (line 37) | void delete_number(large_num *num)
function add_digit (line 48) | void add_digit(large_num *num, unsigned int value)
function multiply (line 66) | void multiply(large_num *num, unsigned long n)
function main (line 94) | int main(int argc, char *argv[])
FILE: math/factorial_trailing_zeroes.c
function main (line 7) | int main()
FILE: math/fibonacci.c
function fib (line 26) | unsigned int fib(int number)
function getInput (line 50) | int getInput(void)
function test (line 92) | static void test()
function main (line 103) | int main()
FILE: math/fibonacci_dp.c
function fib (line 10) | int fib(int n)
function main (line 38) | int main(int argc, char *argv[])
FILE: math/fibonacci_fast.c
function fib (line 23) | void fib(unsigned long n, unsigned long *C, unsigned long *D)
function main (line 65) | int main(int argc, char *argv[])
FILE: math/fibonacci_formula.c
function fib (line 17) | int fib(unsigned int n) {
function test (line 28) | static void test () {
function main (line 52) | int main() {
FILE: math/gcd.c
function GCD (line 4) | int GCD(int x, int y)
function main (line 11) | int main()
FILE: math/is_armstrong.c
function main (line 3) | int main()
FILE: math/large_factorials.c
function main (line 3) | int main()
FILE: math/lcm.c
function gcd (line 11) | int gcd(int a, int b)
function lcm (line 19) | int lcm(int a, int b) { return (a * b) / gcd(a, b); }
function main (line 22) | int main()
FILE: math/lerp.c
function lerp (line 4) | float lerp(float k0, float k1, float t) { return k0 + t * (k1 - k0); }
function lerp_precise (line 6) | float lerp_precise(int k0, int k1, float t) { return (1 - t) * k0 + t * ...
function main (line 8) | int main()
FILE: math/palindrome.c
function main (line 14) | int main()
function isPalindrome (line 29) | bool isPalindrome(int number)
FILE: math/prime.c
function isPrime (line 16) | bool isPrime(int x)
function test (line 43) | void test()
function main (line 67) | int main()
FILE: math/prime_factoriziation.c
type range (line 24) | typedef struct data
type range (line 29) | typedef range *Range;
function main (line 46) | int main()
function Range (line 60) | Range int_fact(int n)
function print_arr (line 136) | void print_arr(Range pStr)
function destroy (line 160) | void destroy(Range r)
FILE: math/prime_sieve.c
function prime (line 21) | void prime(int *p)
function count (line 42) | int count(int *arr, const int size){
function test (line 56) | static void test()
function main (line 73) | int main(int argc, const char *argv[])
FILE: math/strong_number.c
function isStrong (line 15) | bool isStrong(int number)
function test (line 43) | void test()
function main (line 53) | int main()
FILE: misc/demonetization.c
function ways (line 8) | int ways(int n, int *a, int k)
function main (line 19) | int main()
FILE: misc/hamming_distance.c
function hamming_distance (line 21) | int hamming_distance(char* str1, char* str2)
function test (line 41) | static void test()
function main (line 58) | int main()
FILE: misc/lexicographic_permutations.c
function swap (line 5) | void swap(char *left, char *right)
function compare (line 12) | int compare(const void *a, const void *b) { return (*(char *)a - *(char ...
function PrintSortedPermutations (line 14) | void PrintSortedPermutations(char *str)
function main (line 51) | int main()
FILE: misc/longest_subsequence.c
function longestSub (line 4) | void longestSub(int *ARRAY, int ARRAY_LENGTH, int **RESULT, int *RESULT_...
function main (line 82) | int main()
FILE: misc/mcnaughton_yamada_thompson.c
type ASTNode (line 27) | struct ASTNode {
type ASTNode (line 33) | struct ASTNode
type ASTNode (line 34) | struct ASTNode
type ASTNode (line 36) | struct ASTNode
type transRule (line 41) | struct transRule {
type transRule (line 46) | struct transRule
type NFAState (line 46) | struct NFAState
type transRule (line 47) | struct transRule
type NFAState (line 54) | struct NFAState {
type NFAState (line 59) | struct NFAState
type NFAState (line 60) | struct NFAState
type NFA (line 70) | struct NFA {
type NFA (line 82) | struct NFA
type NFA (line 83) | struct NFA
type NFA (line 84) | struct NFA
type NFAState (line 84) | struct NFAState
type NFA (line 85) | struct NFA
type transRule (line 85) | struct transRule
type NFA (line 86) | struct NFA
type NFA (line 87) | struct NFA
type NFA (line 88) | struct NFA
function isLiteral (line 99) | int isLiteral(const char ch) {
function indexOf (line 151) | size_t indexOf(const char* str, char key) {
type ASTNode (line 189) | struct ASTNode
type ASTNode (line 191) | struct ASTNode
function redirect (line 267) | void redirect(struct NFA* nfa, struct NFAState* src, struct NFAState* de...
type NFA (line 279) | struct NFA
type ASTNode (line 279) | struct ASTNode
type NFA (line 281) | struct NFA
type NFA (line 298) | struct NFA
type NFA (line 299) | struct NFA
type NFA (line 308) | struct NFA
type NFA (line 308) | struct NFA
type NFAState (line 310) | struct NFAState
type NFA (line 312) | struct NFA
type transRule (line 314) | struct transRule
type NFAState (line 316) | struct NFAState
type NFA (line 330) | struct NFA
type NFA (line 331) | struct NFA
type NFA (line 344) | struct NFA
function addState (line 369) | void addState(struct NFA* nfa, struct NFAState* state) {
function addRule (line 380) | void addRule(struct NFA* nfa, struct transRule* rule, int loc) {
function postProcessing (line 393) | void postProcessing(struct NFA* nfa) {
function contains (line 428) | int contains(struct NFAState** states, int len, struct NFAState* state) {
function findEmpty (line 446) | void findEmpty(struct NFAState* target, struct NFAState** states, int *s...
function transit (line 465) | void transit(struct NFA* nfa, char input) {
function isAccepting (line 522) | int isAccepting(const struct NFA* nfa) {
function testHelper (line 540) | void testHelper(const char* regex, const char* string, const int expecte...
function test (line 572) | static void test(void) {
function main (line 593) | int main(void) {
type ASTNode (line 606) | struct ASTNode
type ASTNode (line 607) | struct ASTNode
type ASTNode (line 607) | struct ASTNode
function destroyNode (line 619) | void destroyNode(struct ASTNode* node) {
type transRule (line 637) | struct transRule
type NFAState (line 637) | struct NFAState
type transRule (line 638) | struct transRule
type transRule (line 638) | struct transRule
function destroyRule (line 649) | void destroyRule(struct transRule* rule) {
type NFAState (line 657) | struct NFAState
type NFAState (line 658) | struct NFAState
type NFAState (line 658) | struct NFAState
type transRule (line 660) | struct transRule
function destroyState (line 669) | void destroyState(struct NFAState* state) {
type NFA (line 678) | struct NFA
type NFA (line 679) | struct NFA
type NFA (line 679) | struct NFA
type NFAState (line 682) | struct NFAState
type transRule (line 684) | struct transRule
type NFAState (line 686) | struct NFAState
type NFA (line 688) | struct NFA
function destroyNFA (line 701) | void destroyNFA(struct NFA* nfa) {
FILE: misc/mirror.c
function main (line 9) | int main(int argc, char *argv[])
function saisie (line 16) | void saisie(char *cpointeur)
function compte (line 48) | int compte(char *s)
FILE: misc/pid.c
type pid (line 30) | struct pid
function pid_step (line 42) | float pid_step(struct pid *controller, float dt, float error)
function main (line 58) | int main()
FILE: misc/poly_add.c
type term (line 19) | struct term
function free_poly (line 31) | void free_poly(struct term *poly)
function create_polynomial (line 48) | void create_polynomial(struct term **poly, int coef, int pow)
function poly_add (line 73) | void poly_add(struct term **pol, struct term *poly1, struct term *poly2)
function display_polynomial (line 164) | void display_polynomial(struct term *poly)
function test1 (line 186) | static void test1(struct term *poly1, struct term *poly2, struct term *p...
function test2 (line 221) | static void test2(struct term *poly1, struct term *poly2, struct term *p...
function test3 (line 261) | static void test3(struct term *poly1, struct term *poly2, struct term *p...
function main (line 293) | int main(void)
FILE: misc/postfix_evaluation.c
type Stack (line 20) | struct Stack {
type Stack (line 24) | struct Stack
function push (line 31) | void push(int8_t opd) {
function pop (line 44) | int8_t pop() {
function evaluate (line 60) | int8_t evaluate(char post[]) {
function test (line 105) | static void test() {
function main (line 124) | int main() {
FILE: misc/quartile.c
function main (line 5) | int main()
FILE: misc/rselect.c
function swap (line 4) | void swap(int *a, int *b)
function part (line 11) | int part(int a[], int l, int r, int n, int pivot, int pindex)
function rselect (line 35) | int rselect(int a[], int l, int r, int n, int o)
function main (line 65) | int main()
FILE: misc/run_length_encoding.c
function test (line 71) | static void test() {
function main (line 88) | int main() {
FILE: misc/shunting_yard.c
function getPrecedence (line 22) | int getPrecedence(char operator) {
function getAssociativity (line 48) | int getAssociativity(char operator) {
function shuntingYard (line 73) | int shuntingYard(const char *input, char *output) {
function test (line 205) | static void test() {
function main (line 235) | int main() {
FILE: misc/sudoku_solver.c
type sudoku (line 32) | struct sudoku
function OKrow (line 48) | bool OKrow(const struct sudoku *a, int x, int y, int v)
function OKcol (line 67) | bool OKcol(const struct sudoku *a, int x, int y, int v)
function OKbox (line 85) | bool OKbox(const struct sudoku *a, int x, int y, int v)
function OK (line 111) | bool OK(const struct sudoku *a, int x, int y, int v)
function print (line 126) | void print(const struct sudoku *a)
function get_next_unknown (line 144) | bool get_next_unknown(const struct sudoku *a, int *x, int *y)
function solve (line 172) | bool solve(struct sudoku *a)
function test (line 221) | void test()
function main (line 246) | int main()
FILE: misc/tower_of_hanoi.c
function hanoi (line 6) | void hanoi(int noOfDisks, char where, char to, char extra)
function main (line 15) | int main(void)
FILE: misc/union_find.c
function find (line 17) | int find(int *p, int x)
function join (line 42) | void join(int *p, int x, int y) { p[find(p, x)] = find(p, y); }
function main (line 45) | int main()
FILE: numerical_methods/bisection_method.c
function sign (line 32) | double sign(double a, double b)
function func (line 43) | double func(double x)
function bisection (line 58) | double bisection(double x_left, double x_right, double tolerance)
function test (line 91) | static void test()
function main (line 107) | int main()
FILE: numerical_methods/durand_kerner_roots.c
function poly_function (line 50) | long double complex poly_function(long double *coeffs, unsigned int degree,
function check_termination (line 83) | char check_termination(long double delta)
function main (line 95) | int main(int argc, char **argv)
FILE: numerical_methods/gauss_elimination.c
function display (line 6) | void display(float a[ARRAY_SIZE][ARRAY_SIZE], int n)
function interchange (line 19) | float interchange(float m[ARRAY_SIZE][ARRAY_SIZE], int i, int n)
function eliminate (line 41) | float eliminate(float m[ARRAY_SIZE][ARRAY_SIZE], int i, int n)
function main (line 56) | int main(void)
FILE: numerical_methods/gauss_seidel_method.c
function main (line 4) | int main()
FILE: numerical_methods/lagrange_theorem.c
function main (line 5) | int main()
FILE: numerical_methods/lu_decompose.c
function lu_decomposition (line 20) | int lu_decomposition(double **A, double **L, double **U, int mat_size)
function display (line 66) | void display(double **A, int N)
function main (line 79) | int main(int argc, char **argv)
FILE: numerical_methods/mean.c
function main (line 8) | int main(int argc, char **argv)
FILE: numerical_methods/median.c
function main (line 5) | int main()
FILE: numerical_methods/newton_raphson_root.c
function func (line 22) | double complex func(double complex x)
function d_func (line 32) | double complex d_func(double complex x) { return 2. * x; }
function main (line 37) | int main(int argc, char **argv)
FILE: numerical_methods/ode_forward_euler.c
function problem (line 55) | void problem(const double *x, double *y, double *dy)
function exact_solution (line 68) | void exact_solution(const double *x, double *y)
function forward_euler_step (line 82) | void forward_euler_step(const double dx, const double *x, double *y, dou...
function forward_euler (line 99) | double forward_euler(double dx, double x0, double x_max, double *y,
function main (line 137) | int main(int argc, char *argv[])
FILE: numerical_methods/ode_midpoint_euler.c
function problem (line 54) | void problem(const double *x, double *y, double *dy)
function exact_solution (line 67) | void exact_solution(const double *x, double *y)
function midpoint_euler_step (line 83) | void midpoint_euler_step(double dx, double *x, double *y, double *dy)
function midpoint_euler (line 106) | double midpoint_euler(double dx, double x0, double x_max, double *y,
function main (line 144) | int main(int argc, char *argv[])
FILE: numerical_methods/ode_semi_implicit_euler.c
function problem (line 58) | void problem(const double *x, double *y, double *dy)
function exact_solution (line 71) | void exact_solution(const double *x, double *y)
function semi_implicit_euler_step (line 85) | void semi_implicit_euler_step(double dx, double *x, double *y, double *dy)
function semi_implicit_euler (line 109) | double semi_implicit_euler(double dx, double x0, double x_max, double *y,
function main (line 147) | int main(int argc, char *argv[])
FILE: numerical_methods/qr_decompose.h
function print_matrix (line 22) | void print_matrix(double **A, /**< matrix to print */
function vector_dot (line 43) | double vector_dot(double *a, double *b, int L)
function vector_mag (line 64) | double vector_mag(double *vector, int L)
function qr_decompose (line 142) | void qr_decompose(double **A, /**< input matrix to decompose */
FILE: numerical_methods/qr_decomposition.c
function main (line 18) | int main(void)
FILE: numerical_methods/qr_eigen_values.c
function create_matrix (line 27) | void create_matrix(double **A, int N)
function eigen_values (line 106) | double eigen_values(double **A, double *eigen_vals, int mat_size,
function test1 (line 224) | void test1()
function test2 (line 271) | void test2()
function main (line 315) | int main(int argc, char **argv)
FILE: numerical_methods/realtime_stats.c
function stats_computer1 (line 24) | void stats_computer1(float x, float *mean, float *variance, float *std)
function stats_computer2 (line 61) | void stats_computer2(float x, float *mean, float *variance, float *std)
function test_function (line 92) | void test_function(const float *test_data, const int number_of_samples)
function main (line 128) | int main(int argc, char **argv)
FILE: numerical_methods/secant_method.c
function func (line 21) | double func(double x)
function secant_method (line 36) | double secant_method(double x0, double x1, double tolerance)
function test (line 61) | static void test()
function main (line 76) | int main()
FILE: numerical_methods/simpsons_1_3rd_rule.c
function f (line 4) | float f(float x)
function main (line 10) | int main()
FILE: numerical_methods/variance.c
function main (line 5) | int main()
FILE: process_scheduling_algorithms/non_preemptive_priority_scheduling.c
type node (line 28) | typedef struct node {
function insert (line 48) | void insert(node **root, int id, int at, int bt, int prior)
function delete (line 81) | void delete(node **root, int id)
function show_list (line 114) | void show_list(node *head)
function l_length (line 129) | int l_length(node **root)
function update (line 150) | void update(node **root, int id, int ct, int wt, int tat)
function compare (line 199) | bool compare(node *a, node *b)
function calculate_ct (line 215) | float calculate_ct(node **root)
function calculate_tat (line 282) | float calculate_tat(node **root)
function calculate_wt (line 307) | float calculate_wt(node **root)
function test (line 332) | static void test()
function main (line 364) | int main()
FILE: project_euler/problem_1/sol1.c
function main (line 12) | int main()
FILE: project_euler/problem_1/sol2.c
function main (line 15) | int main()
FILE: project_euler/problem_1/sol3.c
function main (line 14) | int main()
FILE: project_euler/problem_1/sol4.c
function main (line 12) | int main()
FILE: project_euler/problem_10/sol1.c
function is_prime (line 11) | char is_prime(unsigned long n)
function sum_of_primes (line 21) | unsigned long long sum_of_primes(unsigned long N)
function main (line 33) | int main(int argc, char *argv[])
FILE: project_euler/problem_10/sol2.c
function main (line 11) | int main(int argc, char *argv[])
FILE: project_euler/problem_12/sol1.c
function count_divisors (line 19) | long count_divisors(long long n)
function main (line 33) | int main(int argc, char **argv)
FILE: project_euler/problem_13/sol1.c
function get_number (line 16) | int get_number(FILE *fp, char *buffer, uint8_t *out_int)
function add_numbers (line 48) | int add_numbers(uint8_t *a, uint8_t *b, uint8_t N)
function print_number (line 92) | int print_number(uint8_t *number, uint8_t N, int8_t num_digits_to_print)
function main (line 123) | int main(void)
FILE: project_euler/problem_14/sol1.c
function collatz (line 27) | long long collatz(long long start_num)
function main (line 44) | int main(int argc, char **argv)
FILE: project_euler/problem_15/sol1.c
function number_of_paths (line 17) | unsigned long long number_of_paths(int N)
function main (line 30) | int main(int argc, char **argv)
FILE: project_euler/problem_16/sol1.c
function main (line 12) | int main(int argc, char **argv)
FILE: project_euler/problem_19/sol1.c
function get_month_days (line 15) | char get_month_days(short month)
function is_leap_year (line 41) | char is_leap_year(short year)
function main (line 79) | int main(int argc, char **argv)
FILE: project_euler/problem_2/so1.c
function main (line 17) | int main()
FILE: project_euler/problem_20/sol1.c
type big_int (line 17) | typedef struct _big_int
function print_digit (line 26) | void print_digit(const big_int *my_int)
function big_int (line 37) | big_int *add_digit(big_int *digit, char value)
function remove_digits (line 76) | char remove_digits(big_int *digit, int N)
function main (line 95) | int main(int argc, char **argv)
FILE: project_euler/problem_21/sol1.c
function sum_of_divisors (line 13) | unsigned long sum_of_divisors(unsigned int N)
function main (line 36) | int main(int argc, char **argv)
FILE: project_euler/problem_22/sol1.c
function shell_sort (line 20) | void shell_sort(char data[][MAX_NAME_LEN], int LEN)
function lazy_sort (line 48) | void lazy_sort(char data[][MAX_NAME_LEN], int LEN)
function main (line 70) | int main(int argc, char **argv)
FILE: project_euler/problem_23/sol1.c
function get_perfect_number (line 19) | char get_perfect_number(unsigned long N)
function is_abundant (line 47) | unsigned long is_abundant(unsigned long N)
function get_next_abundant (line 55) | unsigned long get_next_abundant(unsigned long N)
function is_sum_of_abundant (line 71) | char is_sum_of_abundant(unsigned long N)
function main (line 92) | int main(int argc, char **argv)
FILE: project_euler/problem_23/sol2.c
function get_perfect_number (line 31) | char get_perfect_number(unsigned long N)
function is_abundant (line 59) | char is_abundant(unsigned long N)
function get_next_abundant (line 70) | unsigned long get_next_abundant(unsigned long N)
function is_sum_of_abundant (line 87) | char is_sum_of_abundant(unsigned long N)
function main (line 108) | int main(int argc, char **argv)
FILE: project_euler/problem_25/sol1.c
function add_numbers (line 19) | unsigned int add_numbers(unsigned char *a, unsigned char *b, unsigned ch...
function print_number (line 62) | int print_number(unsigned char *number, int N)
function get_digits (line 75) | unsigned int get_digits(unsigned char *number)
function main (line 83) | int main(int argc, char *argv[])
FILE: project_euler/problem_26/sol1.c
function compare (line 19) | int compare(const void *a, const void *b)
function main (line 25) | int main(int argc, char *argv[])
FILE: project_euler/problem_3/sol1.c
function isprime (line 15) | char isprime(int no)
function main (line 39) | int main()
FILE: project_euler/problem_3/sol2.c
function main (line 14) | int main()
FILE: project_euler/problem_4/sol.c
function is_palindromic (line 12) | int is_palindromic(unsigned int n)
function main (line 25) | int main(void)
FILE: project_euler/problem_401/sol1.c
function is_in (line 28) | char is_in(uint64_t N, uint64_t *D, uint64_t L)
function get_divisors (line 47) | uint64_t get_divisors(uint64_t N, uint64_t *D)
function sigma2 (line 93) | uint64_t sigma2(uint64_t N)
function sigma (line 114) | uint64_t sigma(uint64_t N)
function main (line 132) | int main(int argc, char **argv)
FILE: project_euler/problem_5/sol1.c
function check_number (line 18) | static char check_number(unsigned long long n)
function main (line 36) | int main(void)
FILE: project_euler/problem_5/sol2.c
function check_number (line 30) | static int check_number(unsigned long long n)
function main (line 48) | int main(void)
FILE: project_euler/problem_5/sol3.c
function gcd (line 18) | unsigned long gcd(unsigned long a, unsigned long b)
function lcm (line 41) | unsigned long lcm(unsigned long a, unsigned long b)
function main (line 50) | int main(void)
FILE: project_euler/problem_6/sol.c
function main (line 8) | int main(void)
FILE: project_euler/problem_7/sol.c
function main (line 12) | int main(void)
FILE: project_euler/problem_7/sol2.c
function main (line 11) | int main()
FILE: project_euler/problem_8/sol1.c
function get_product (line 16) | long long int get_product(FILE *fp, long start_pos, int num_digits)
function main (line 62) | int main(int argc, char *argv[])
FILE: project_euler/problem_8/sol2.c
function main (line 11) | int main(int argc, char *argv[])
FILE: project_euler/problem_9/sol1.c
function main (line 10) | int main(void)
FILE: project_euler/problem_9/sol2.c
function main (line 23) | int main(void)
FILE: scripts/leetcode_directory_md.py
class Task (line 11) | class Task:
function fetch_leetcode_folder_tasks (line 20) | def fetch_leetcode_folder_tasks(solutions_folder: Path) -> list[Task]:
function print_directory_md (line 65) | def print_directory_md(tasks_list: list[Task]) -> None:
FILE: searching/binary_search.c
function binarysearch1 (line 21) | int binarysearch1(const int *arr, int l, int r, int x)
function binarysearch2 (line 51) | int binarysearch2(const int *arr, int l, int r, int x)
function test (line 75) | void test()
function main (line 105) | int main(void)
FILE: searching/exponential_search.c
function exponential_search (line 29) | int64_t exponential_search(const int64_t* arr, const uint16_t length, co...
function binary_search (line 56) | int64_t binary_search(const int64_t* arr, const uint16_t l_index, const ...
function main (line 72) | int main()
function test (line 82) | static void test()
FILE: searching/fibonacci_search.c
function fibMonaccianSearch (line 4) | int fibMonaccianSearch(int arr[], int x, int n)
function main (line 65) | int main(void)
FILE: searching/floyd_cycle_detection_algorithm.c
function duplicateNumber (line 25) | uint32_t duplicateNumber(const uint32_t *in_arr, size_t n)
function test (line 49) | static void test()
function main (line 64) | int main()
FILE: searching/interpolation_search.c
function interpolationSearch (line 17) | int interpolationSearch(int arr[], int n, int key)
function main (line 36) | int main()
FILE: searching/jump_search.c
function jump_search (line 24) | int jump_search(const int *arr, int x, size_t n)
function test (line 58) | void test()
function main (line 81) | int main()
FILE: searching/linear_search.c
function linearsearch (line 4) | int linearsearch(int *arr, int size, int val)
function main (line 15) | int main()
FILE: searching/modified_binary_search.c
function binarySearch (line 18) | int binarySearch(const int **mat, int i, int j_low, int j_high, int x)
function modifiedBinarySearch (line 48) | void modifiedBinarySearch(const int **mat, int n, int m, int x)
function main (line 97) | int main()
FILE: searching/other_binary_search.c
function binarySearch (line 5) | int binarySearch(int array[], int leng, int searchX)
function main (line 31) | int main(int argc, char *argv[])
FILE: searching/pattern_search/boyer_moore_search.c
function max (line 6) | int max(int a, int b) { return (a > b) ? a : b; }
function computeArray (line 8) | void computeArray(char *pattern, int size, int arr[NUM_OF_CHARS])
function boyer_moore_search (line 17) | void boyer_moore_search(char *str, char *pattern)
function main (line 41) | int main()
FILE: searching/pattern_search/naive_search.c
function naive_search (line 5) | void naive_search(char *str, char *pattern)
function main (line 23) | int main()
FILE: searching/pattern_search/rabin_karp_search.c
function rabin_karp_search (line 7) | void rabin_karp_search(char *str, char *pattern, int d, int q)
function main (line 49) | int main()
FILE: searching/sentinel_linear_search.c
function sentinel_linear_search (line 36) | int sentinel_linear_search( int arr[], int len, int key ){
function test (line 59) | static void test(){
function main (line 76) | int main(){
FILE: searching/ternary_search.c
function ternarySearch (line 5) | int ternarySearch(int l, int r, int key, int ar[])
function main (line 50) | int main()
FILE: sorting/bead_sort.c
function display (line 23) | void display(const int *arr, int n)
function bead_sort (line 37) | void bead_sort(int *a, size_t len)
function main (line 75) | int main(int argc, const char *argv[])
FILE: sorting/binary_insertion_sort.c
function display (line 8) | void display(int *arr, int n)
function binarySearch (line 18) | int binarySearch(int *arr, int key, int low, int high)
function insertionSort (line 34) | void insertionSort(int *arr, int size)
function main (line 55) | int main(int argc, const char *argv[])
FILE: sorting/bogo_sort.c
function check_sorted (line 5) | bool check_sorted(int *a, int n)
function shuffle (line 15) | void shuffle(int *a, int n)
function sort (line 27) | void sort(int *a, int n)
function main (line 32) | int main()
FILE: sorting/bubble_sort.c
function display (line 17) | void display(const int *arr, int n)
function swap (line 31) | void swap(int *first, int *second)
function bubbleSort (line 43) | void bubbleSort(int *arr, int size)
function test (line 70) | void test()
function main (line 89) | int main(int argc, const char *argv[])
FILE: sorting/bubble_sort_2.c
function bubble_sort (line 24) | void bubble_sort(int* array_sort)
function test (line 58) | static void test() {
function main (line 83) | int main()
FILE: sorting/bubble_sort_recursion.c
function swap (line 17) | void swap(int *first, int *second)
function bubbleSort (line 29) | void bubbleSort(int *arr, int size)
function test (line 53) | void test()
function main (line 72) | int main()
FILE: sorting/bucket_sort.c
type Node (line 13) | struct Node
type Node (line 20) | struct Node
type Node (line 20) | struct Node
type Node (line 22) | struct Node
function BucketSort (line 25) | void BucketSort(int arr[])
type Node (line 107) | struct Node
type Node (line 107) | struct Node
type Node (line 109) | struct Node
type Node (line 121) | struct Node
type Node (line 125) | struct Node
type Node (line 144) | struct Node
function getBucketIndex (line 162) | int getBucketIndex(int value) { return value / INTERVAL; }
function print (line 164) | void print(int ar[])
function printBuckets (line 174) | void printBuckets(struct Node *list)
function main (line 184) | int main(void)
FILE: sorting/cocktail_sort.c
function cocktailSort (line 7) | void cocktailSort(int arr[], int size)
function main (line 46) | int main()
FILE: sorting/comb_sort.c
function sort (line 5) | void sort(int *numbers, int size)
function display (line 25) | void display(int *array, int n)
function main (line 32) | int main()
FILE: sorting/counting_sort.c
function main (line 12) | int main()
FILE: sorting/cycle_sort.c
function display (line 6) | void display(int *arr, int n)
function swap (line 18) | void swap(int *first, int *second)
function cycleSort (line 26) | void cycleSort(int *arr, int n)
function main (line 83) | int main()
FILE: sorting/gnome_sort.c
function sort (line 4) | void sort(int *numbers, int size)
function display (line 24) | void display(int *array, int n)
function main (line 31) | int main()
FILE: sorting/heap_sort.c
function max_heapify (line 7) | void max_heapify(int *a, int i, int n)
function heapsort (line 30) | void heapsort(int *a, int n)
function build_maxheap (line 42) | void build_maxheap(int *a, int n)
function main (line 51) | int main()
FILE: sorting/heap_sort_2.c
function swap (line 32) | void swap(int8_t *first, int8_t *second)
function heapifyDown (line 48) | void heapifyDown(int8_t *arr, const uint8_t size)
function heapifyUp (line 82) | void heapifyUp(int8_t *arr, uint8_t i)
function heapSort (line 97) | void heapSort(int8_t *arr, const uint8_t size)
function test (line 127) | static void test()
function main (line 149) | int main()
FILE: sorting/insertion_sort.c
function insertionSort (line 16) | void insertionSort(int *arr, int size)
function test (line 36) | static void test()
function main (line 53) | int main(int argc, const char *argv[])
FILE: sorting/insertion_sort_recursive.c
function RecursionInsertionSort (line 20) | void RecursionInsertionSort(int *arr, int size)
function test (line 44) | static void test()
function main (line 65) | int main(int argc, const char *argv[])
FILE: sorting/merge_sort.c
function swap (line 17) | void swap(int *a, int *b)
function merge (line 33) | void merge(int *a, int l, int r, int n)
function merge_sort (line 87) | void merge_sort(int *a, int n, int l, int r)
function main (line 106) | int main(void)
FILE: sorting/merge_sort_nr.c
function mergesort (line 19) | void mergesort(int x[], int n)
function show (line 63) | void show(int x[], int n)
function main (line 70) | int main() // main function
FILE: sorting/multikey_quick_sort.c
function vecswap (line 29) | void vecswap(int i, int j, int n, char *x[])
function ssort1 (line 39) | void ssort1(char *x[], int n, int depth)
function ssort1main (line 87) | void ssort1main(char *x[], int n) { ssort1(x, n, 0); }
function vecswap2 (line 91) | void vecswap2(char **a, char **b, int n)
function inssort (line 121) | void inssort(char **a, int n, int d)
function ssort2 (line 136) | void ssort2(char **a, int n, int depth)
function ssort2main (line 199) | void ssort2main(char **a, int n) { ssort2(a, n, 0); }
type tnode (line 203) | struct tnode
type Tnode (line 204) | typedef struct tnode
function Tptr (line 213) | Tptr insert1(Tptr p, char *s)
function cleanup1 (line 233) | void cleanup1(Tptr p)
function insert2 (line 252) | void insert2(char *s)
function cleanup2 (line 295) | void cleanup2()
function search1 (line 303) | int search1(char *s)
function search2 (line 323) | int search2(char *s)
function pmsearch (line 352) | void pmsearch(Tptr p, char *s)
function nearsearch (line 368) | void nearsearch(Tptr p, char *s, int d)
function main (line 388) | int main(int argc, char *argv[])
FILE: sorting/odd_even_sort.c
function swap (line 26) | void swap(int32_t *first, int32_t *second)
function oddEvenSort (line 52) | void oddEvenSort(int *arr, int size)
function test (line 90) | static void test()
function main (line 116) | int main()
FILE: sorting/pancake_sort.c
function flip (line 6) | void flip(int arr[], int i)
function findMax (line 21) | int findMax(int arr[], int n)
function pancakeSort (line 33) | void pancakeSort(int *arr, int n)
function display (line 55) | void display(int arr[], int n)
function main (line 68) | int main()
FILE: sorting/partition_sort.c
function swap (line 4) | void swap(int *a, int *b)
function partition (line 11) | int partition(int arr[], int low, int high)
function partitionSort (line 38) | void partitionSort(int arr[], int low, int high)
function printArray (line 48) | void printArray(int arr[], int n)
function main (line 55) | int main()
FILE: sorting/patience_sort.c
function patienceSort (line 22) | void patienceSort(int *array, int length) {
function printArray (line 104) | void printArray(int *array,int length) {
function testArray (line 120) | void testArray(int *array,int length) {
function test (line 139) | static void test() {
function main (line 157) | int main() {
FILE: sorting/pigeonhole_sort.c
function pigeonholeSort (line 4) | void pigeonholeSort(int arr[], int size)
function main (line 44) | int main()
FILE: sorting/quick_sort.c
function display (line 5) | void display(int arr[], int n)
function swap (line 17) | void swap(int *first, int *second)
function partition (line 31) | int partition(int arr[], int lower, int upper)
function quickSort (line 59) | void quickSort(int arr[], int lower, int upper)
function main (line 74) | int main()
FILE: sorting/radix_sort.c
function largest (line 3) | int largest(int a[], int n)
function RadixSort (line 14) | void RadixSort(int a[], int n)
function main (line 56) | int main()
FILE: sorting/radix_sort_2.c
function MAX (line 8) | int MAX(int *ar, int size)
function countSort (line 20) | void countSort(int *arr, int n, int place)
function radixsort2 (line 50) | void radixsort2(int *arr, int n,
function display (line 62) | void display(int *arr, int N)
function main (line 68) | int main(int argc, const char *argv[])
FILE: sorting/random_quick_sort.c
function getBig (line 13) | int getBig(int *a, int i, int right, int pivot)
function getSmall (line 23) | int getSmall(int *a, int j, int left, int pivot)
function swap (line 33) | void swap(int *a, int *b)
function random_quick (line 40) | void random_quick(int *a, int left, int right)
function main (line 81) | int main()
FILE: sorting/selection_sort.c
function swap (line 16) | void swap(int *first, int *second)
function selectionSort (line 28) | void selectionSort(int *arr, int size)
function test (line 50) | static void test()
function main (line 69) | int main(int argc, const char *argv[])
FILE: sorting/selection_sort_recursive.c
function swap (line 19) | void swap(int8_t *first, int8_t *second)
function findIndex (line 32) | uint8_t findIndex(const int8_t *arr, const uint8_t size)
function selectionSort (line 56) | void selectionSort(int8_t *arr, const uint8_t size)
function test (line 80) | static void test()
function main (line 102) | int main()
FILE: sorting/shaker_sort.c
function swap (line 4) | void swap(int *a, int *b)
function shakersort (line 11) | void shakersort(int *a, int n)
function main (line 28) | int main()
FILE: sorting/shell_sort.c
function show_data (line 13) | void show_data(int arr[], int len)
function swap (line 21) | void swap(int *a, int *b)
function shellSort (line 30) | void shellSort(int array[], int len)
function main (line 40) | int main(int argc, char *argv[])
FILE: sorting/shell_sort2.c
function show_data (line 16) | void show_data(int *arr, long len)
function swap (line 26) | inline void swap(int *a, int *b)
function shell_sort (line 41) | void shell_sort(int *array, long LEN)
function main (line 66) | int main(int argc, char *argv[])
FILE: sorting/stooge_sort.c
function main (line 4) | int main()
function stoogesort (line 21) | void stoogesort(int arr[], int i, int j)
Condensed preview — 497 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,404K chars).
[
{
"path": ".clang-format",
"chars": 4482,
"preview": "---\nLanguage: Cpp\nAccessModifierOffset: -4\nAlignAfterOpenBracket: Align\nAlignConsecutiveMacros: false\nAlignConsec"
},
{
"path": ".clang-tidy",
"chars": 691,
"preview": "---\nChecks: '-*,google-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.*,openmp-*,pe"
},
{
"path": ".github/CODEOWNERS",
"chars": 44,
"preview": "* @Panquesito7 @tjgurwara99 @alexpantyukhin\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 1725,
"preview": "name: Bug report\ndescription: Create a report to help us improve. Report bugs found while using the project\ntitle: \"[BUG"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 195,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: Discord community\n url: https://the-algorithms.com/discord/\n "
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 1141,
"preview": "name: Feature request\ndescription: Suggest features, propose improvements, discuss new ideas.\ntitle: \"[FEATURE]\"\nlabels:"
},
{
"path": ".github/ISSUE_TEMPLATE/other.yml",
"chars": 553,
"preview": "name: Other issue\ndescription: Use this for any other issues. Do NOT create blank issues\ntitle: \"[OTHER]\"\nlabels: [\"awai"
},
{
"path": ".github/labeler.yml",
"chars": 43,
"preview": "Leetcode folder changes:\r\n- leetcode/**/*\r\n"
},
{
"path": ".github/pull_request_template.md",
"chars": 1076,
"preview": "#### Description of Change\n\n<!--\nThank you for your Pull Request. Please provide a description above and review\nthe requ"
},
{
"path": ".github/workflows/approved-label.yml",
"chars": 413,
"preview": "on: pull_request_review\nname: Add \"approved\" label when approved\njobs:\n add_label:\n name: Add \"approved\" label when "
},
{
"path": ".github/workflows/awesome_workflow.yml",
"chars": 2648,
"preview": "name: Awesome CI Workflow\non: [push, pull_request]\npermissions:\n contents: write\n\njobs:\n MainSequence:\n name: Code "
},
{
"path": ".github/workflows/codeql.yml",
"chars": 1946,
"preview": "name: \"Code Scanning - Action\"\n\non:\n push:\n branches: [master]\n pull_request:\n branches: [master]\n schedule:\n "
},
{
"path": ".github/workflows/directory_writer.yml",
"chars": 888,
"preview": "name: Directory writer\non:\n schedule:\n # ┌───────────── minute (0 - 59)\n # │ ┌───────────── hour (0 - "
},
{
"path": ".github/workflows/gh-pages.yml",
"chars": 1138,
"preview": "name: Doxygen CI\n\non: \n push:\n branches: [master]\n\njobs:\n build:\n runs-on: macos-latest\n steps:\n - uses:"
},
{
"path": ".github/workflows/labeler.yml",
"chars": 282,
"preview": "name: \"Pull Request Labeler\"\r\non:\r\n- pull_request_target\r\n\r\njobs:\r\n triage:\r\n permissions:\r\n contents: read\r\n "
},
{
"path": ".github/workflows/leetcode_directory_writer.yml",
"chars": 1734,
"preview": "# The objective of this GitHub Action is to update the leetcode DIRECTORY.md file (if needed)\r\n# when doing a git push\r\n"
},
{
"path": ".github/workflows/stale.yml",
"chars": 1470,
"preview": "name: 'Close stale issues and PRs'\non:\n schedule:\n - cron: '0 0 * * *'\njobs:\n stale:\n runs-on: ubuntu-latest\n "
},
{
"path": ".gitignore",
"chars": 47,
"preview": "*.swp\n*.exe\n*.out\n.vscode/\nbuild/\ngit_diff.txt\n"
},
{
"path": ".gitpod.dockerfile",
"chars": 235,
"preview": "FROM gitpod/workspace-full-vnc\n\nRUN sudo apt-get update \\\n && sudo apt-get install -y \\\n doxygen \\\n graphviz \\\n "
},
{
"path": ".gitpod.yml",
"chars": 355,
"preview": "image:\n file: .gitpod.dockerfile\n\ngithub:\n prebuilds:\n addBadge: true\n addComment: false\n addCheck: false\n "
},
{
"path": "CMakeLists.txt",
"chars": 3634,
"preview": "cmake_minimum_required(VERSION 3.22)\nproject(Algorithms_in_C\n LANGUAGES C\n VERSION 1.0.0\n DESCRIPTI"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5489,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": "CONTRIBUTING.md",
"chars": 14407,
"preview": "# CONTRIBUTION GUIDELINES\n\n## Before contributing\n\nWelcome to [TheAlgorithms/C](https://github.com/TheAlgorithms/C)! Bef"
},
{
"path": "CodingGuidelines.md",
"chars": 415,
"preview": "# Code style convention \n\nPlease orient on this guide before you sent a pull request. \n\n---\n\n## User-interface \n\nPlea"
},
{
"path": "DIRECTORY.md",
"chars": 27776,
"preview": "\n## Audio\n * [Alaw](https://github.com/TheAlgorithms/C/blob/HEAD/audio/alaw.c)\n\n## Cipher\n * [Affine](https://github.c"
},
{
"path": "Doxyfile",
"chars": 8461,
"preview": "#\n# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!\n#\n\nDOXYFILE_ENCODING = UTF-8\nPROJECT_NAME = Algorithms"
},
{
"path": "LICENSE",
"chars": 35205,
"preview": "Copyright (C) 2016-2023 TheAlgorithms and contributors\n\n GNU GENERAL PUBLIC LICENSE\n "
},
{
"path": "README.md",
"chars": 5064,
"preview": "# The Algorithms - C # {#mainpage}\n<!-- the suffix in the above line is required for doxygen to consider this as the ind"
},
{
"path": "REVIEWER_CODE.md",
"chars": 2218,
"preview": "# Guidelines for reviewers and maintainers\n\nFollowing are some guidelines for contributors who are providing reviews to "
},
{
"path": "audio/CMakeLists.txt",
"chars": 667,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "audio/alaw.c",
"chars": 6201,
"preview": "/**\n * @file\n * @author [sunzhenliang](https://github.com/HiSunzhenliang)\n * @brief A-law algorithm for encoding and dec"
},
{
"path": "cipher/CMakeLists.txt",
"chars": 755,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. The RELATIVE flag "
},
{
"path": "cipher/affine.c",
"chars": 4969,
"preview": "/**\n * @file\n * @brief An [affine cipher](https://en.wikipedia.org/wiki/Affine_cipher) is a\n * letter substitution ciphe"
},
{
"path": "cipher/rot13.c",
"chars": 1905,
"preview": "/**\n * @file\n * @brief [ROT13](https://en.wikipedia.org/wiki/ROT13) is a simple letter \n * substitution cipher that repl"
},
{
"path": "client_server/CMakeLists.txt",
"chars": 1903,
"preview": "include(CheckIncludeFile)\n\nif(WIN32)\n CHECK_INCLUDE_FILE(winsock2.h WINSOCK_HEADER)\nelse()\n CHECK_INCLUDE_FILE(arp"
},
{
"path": "client_server/bool.h",
"chars": 1224,
"preview": "/*\n * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\n * Copyright (C) 2007 - INRIA\n *\n * Copyright (C) "
},
{
"path": "client_server/client.c",
"chars": 3172,
"preview": "/**\n * @file\n * @author [Nairit11](https://github.com/Nairit11)\n * @author [Krishna Vedala](https://github.com/kvedala)\n"
},
{
"path": "client_server/fork.h",
"chars": 11374,
"preview": "/*\n * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\n * Copyright (C) DIGITEO - 2010 - Allan CORNET\n *\n"
},
{
"path": "client_server/remote_command_exec_udp_client.c",
"chars": 5897,
"preview": "/**\n * @file\n * @author [NVombat](https://github.com/NVombat)\n * @brief Client-side implementation of [Remote Command\n *"
},
{
"path": "client_server/remote_command_exec_udp_server.c",
"chars": 6402,
"preview": "/**\n * @file\n * @author [NVombat](https://github.com/NVombat)\n * @brief Server-side implementation of [Remote Command\n *"
},
{
"path": "client_server/server.c",
"chars": 3967,
"preview": "/**\n * @file\n * @author [Nairit11](https://github.com/Nairit11)\n * @author [Krishna Vedala](https://github.com/kvedala)\n"
},
{
"path": "client_server/tcp_full_duplex_client.c",
"chars": 6968,
"preview": "/**\n * @file\n * @author [NVombat](https://github.com/NVombat)\n * @brief Client-side implementation of [TCP Full Duplex\n "
},
{
"path": "client_server/tcp_full_duplex_server.c",
"chars": 7834,
"preview": "/**\n * @file\n * @author [NVombat](https://github.com/NVombat)\n * @brief Server-side implementation of [TCP Full Duplex\n "
},
{
"path": "client_server/tcp_half_duplex_client.c",
"chars": 6221,
"preview": "/**\n * @file\n * @author [Nikhill Vombatkere](https://github.com/NVombat)\n * @brief Client-side implementation of [TCP Ha"
},
{
"path": "client_server/tcp_half_duplex_server.c",
"chars": 7095,
"preview": "/**\n * @file\n * @author [NVombat](https://github.com/NVombat)\n * @brief Server-side implementation of [TCP Half Duplex\n "
},
{
"path": "client_server/udp_client.c",
"chars": 2207,
"preview": "/**\n * @file\n * @author [TheShubham99](https://github.com/TheShubham99)\n * @author [Krishna Vedala](https://github.com/k"
},
{
"path": "client_server/udp_server.c",
"chars": 2446,
"preview": "/**\n * @file\n * @author [TheShubham99](https://github.com/TheShubham99)\n * @author [Krishna Vedala](https://github.com/k"
},
{
"path": "conversions/CMakeLists.txt",
"chars": 861,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "conversions/binary_to_decimal.c",
"chars": 2181,
"preview": "/**\n * @brief Converts a number from [Binary to Decimal](https://en.wikipedia.org/wiki/Binary-coded_decimal).\n * @detail"
},
{
"path": "conversions/binary_to_hexadecimal.c",
"chars": 455,
"preview": "/*\r\n * C Program to Convert Binary to Hexadecimal\r\n */\r\n#include <stdio.h>\r\n\r\nint main()\r\n{\r\n long int binary, hexa ="
},
{
"path": "conversions/binary_to_octal.c",
"chars": 1088,
"preview": "// Binary number to octal number conversion\n#include <stdio.h>\n\n// Function that returns the last three digits\nint three"
},
{
"path": "conversions/c_atoi_str_to_integer.c",
"chars": 1927,
"preview": "/**\n * \\file\n * \\brief Recoding the original atoi function in stdlib.h\n * \\author [Mohammed YMIK](https://github.com/med"
},
{
"path": "conversions/celsius_to_fahrenheit.c",
"chars": 1753,
"preview": "/**\n * @file\n * @brief Conversion of temperature in degrees from [Celsius](https://en.wikipedia.org/wiki/Celsius)\n * to "
},
{
"path": "conversions/decimal_to_any_base.c",
"chars": 4301,
"preview": "/**\n * @file\n * @author [jucollet972](https://github.com/jucollet972)\n * @brief [Decimal to any-base](http://codeoftheda"
},
{
"path": "conversions/decimal_to_binary.c",
"chars": 1141,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\n#define MAXBITS 100\n\nint main()\n{\n // input of the user\n int inputNumber;\n"
},
{
"path": "conversions/decimal_to_binary_recursion.c",
"chars": 892,
"preview": "/**\n * @file\n * @brief Convert decimal to binary using recursion algorithm\n */\n#include <assert.h>\n\n/**\n * Decimal to bi"
},
{
"path": "conversions/decimal_to_hexa.c",
"chars": 925,
"preview": "/*****Decimal to Hexadecimal conversion*******************/\n#include <stdio.h>\nvoid decimal2Hexadecimal(long num);\n\nint "
},
{
"path": "conversions/decimal_to_octal.c",
"chars": 675,
"preview": "/*****Decimal to octal conversion*******************/\n#include <stdio.h>\nvoid decimal2Octal(long decimalnum);\n\nint main("
},
{
"path": "conversions/decimal_to_octal_recursion.c",
"chars": 684,
"preview": "// Program to convert decimal number to octal (Using Reccursion)\n// This program only works for integer decimals\n// Crea"
},
{
"path": "conversions/hexadecimal_to_octal.c",
"chars": 2525,
"preview": "/* C program to convert Hexadecimal to Octal number system */\n\n#include <stdio.h>\n\nint main()\n{\n#define MAX_STR_LEN 17\n "
},
{
"path": "conversions/hexadecimal_to_octal2.c",
"chars": 2592,
"preview": "/**\n * @file\n * @brief Convert hexadecimal number to octal number (with decimal intermediary)\n * @details\n * The input i"
},
{
"path": "conversions/infix_to_postfix.c",
"chars": 5503,
"preview": "/**\n * @file\n * @brief [Infix to\n * Postfix](https://condor.depaul.edu/ichu/csc415/notes/notes9/Infix.htm)\n * Expression"
},
{
"path": "conversions/infix_to_postfix2.c",
"chars": 4456,
"preview": "/**\n * @file\n * @brief [Infix to Postfix converter](https://www.includehelp.com/c/infix-to-postfix-conversion-using-stac"
},
{
"path": "conversions/int_to_string.c",
"chars": 2472,
"preview": "/**\n * @file\n * @brief Convert a positive integer to string (non-standard function)\n * representation.\n */\n#include <ass"
},
{
"path": "conversions/octal_to_binary.c",
"chars": 1446,
"preview": "/**\n * @brief Octal to binay conversion by scanning user input\n * @details\n * The octalTobinary function take the octal "
},
{
"path": "conversions/octal_to_decimal.c",
"chars": 692,
"preview": "#include <math.h>\n#include <stdio.h>\n\n// Converts octal number to decimal\nint convertValue(int num, int i) { return num "
},
{
"path": "conversions/octal_to_hexadecimal.c",
"chars": 2391,
"preview": "/**\n * @file\n * @brief Octal to hexadecimal conversion by scanning user input\n * @details\n * The octalToHexadecimal func"
},
{
"path": "conversions/roman_numerals_to_decimal.c",
"chars": 3093,
"preview": "/**\n * @file\n * @brief Conversion of [roman numerals](https://en.wikipedia.org/wiki/Roman_numerals) to decimal\n * @detai"
},
{
"path": "conversions/to_decimal.c",
"chars": 842,
"preview": "/*\n * convert from any base to decimal\n */\n\n#include <ctype.h>\n#include <stdio.h>\n\nint main(void)\n{\n int base, i, j;\n"
},
{
"path": "data_structures/array/README.md",
"chars": 566,
"preview": "# Array\n\nSimple array of integers. With I/O functions, Sort Functions and Search Functions.\n\n## Sort Function\n\nThe Sort "
},
{
"path": "data_structures/array/carray.c",
"chars": 5825,
"preview": "/*\n * CArray.c\n *\n * Author: Leonardo Vencovsky\n * Created on 19/03/2018\n *\n * Modified by: Leonardo Vencovsky\n * Last m"
},
{
"path": "data_structures/array/carray.h",
"chars": 2402,
"preview": "/*\n * CArray.h\n *\n * Author: Leonardo Vencovsky\n * Created on 18/03/2018\n *\n * Modified by: Leonardo Vencovsky\n * Last m"
},
{
"path": "data_structures/array/carray_tests.c",
"chars": 4182,
"preview": "/*\n * CArrayTests.c\n *\n * Author: Leonardo Vencovsky\n * Created on 19/03/2018\n *\n * Modified by: Leonardo Vencovsky\n * L"
},
{
"path": "data_structures/binary_trees/avl_tree.c",
"chars": 9160,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\nstruct AVLnode\n{\n int key;\n struct AVLnode *left;\n struct AVLnode *righ"
},
{
"path": "data_structures/binary_trees/binary_search_tree.c",
"chars": 8197,
"preview": "/**\n * @file\n * @brief A basic unbalanced binary search tree implementation in C.\n * @details The implementation has the"
},
{
"path": "data_structures/binary_trees/create_node.c",
"chars": 807,
"preview": "/* Includes structure for a node and a newNode() function which\n can be used to create a new node in the tree.\n It i"
},
{
"path": "data_structures/binary_trees/recursive_traversals.c",
"chars": 975,
"preview": "/* Includes the functions for Recursive Traversals\n of a Binary Tree. It is assumed that nodes and\n tree have been c"
},
{
"path": "data_structures/binary_trees/red_black_tree.c",
"chars": 21228,
"preview": "#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct node\n{\n int val;\n struct node *par;\n s"
},
{
"path": "data_structures/binary_trees/segment_tree.c",
"chars": 7304,
"preview": "/**\n * @file segment_tree.c\n * @brief segment trees with only point updates\n * @details\n * This code implements segment "
},
{
"path": "data_structures/binary_trees/threaded_binary_trees.c",
"chars": 6982,
"preview": "/**\n * @file\n * \\brief This file is a simple implementation of a Threaded Binary Tree\n *\n * Threaded Binary Tree is a bi"
},
{
"path": "data_structures/binary_trees/words_alphabetical.c",
"chars": 10526,
"preview": "/**\n * @file\n * @brief Printing the [words contained in a\n * file](http://www.dailyfreecode.com/Code/word-list-reads-tex"
},
{
"path": "data_structures/dictionary/README.md",
"chars": 1268,
"preview": "## Dictionary \n\nThis is simple and generic dictionary. You can instantiate multiple dictionaries with\nthe constructor. S"
},
{
"path": "data_structures/dictionary/dict.c",
"chars": 2055,
"preview": "#include \"dict.h\"\n#include <stdio.h>\n#include <stdlib.h>\n\n/* simple constructor */\nDictionary *create_dict(void)\n{\n D"
},
{
"path": "data_structures/dictionary/dict.h",
"chars": 1432,
"preview": "/*\n author: Christian Bender\n public interface for the dictionary.\n\n The dictionary prepares space for 1000 ele"
},
{
"path": "data_structures/dictionary/test_program.c",
"chars": 1094,
"preview": "/*\n author: Christian Bender\n This is a simple test program for the dictionary.\n*/\n\n#include <stdio.h>\n\n/* include"
},
{
"path": "data_structures/dynamic_array/Makefile",
"chars": 173,
"preview": "CC = gcc\nCFLAGS = -g -Wall\n\nall: main\n\nmain: main.o dynamic_array.o\n\t$(CC) $(CFLAGS) $^ -o $@\n\ndynamic_array.o: dynamic_"
},
{
"path": "data_structures/dynamic_array/dynamic_array.c",
"chars": 1715,
"preview": "#include \"dynamic_array.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ndynamic_array_t *init_dynamic_arr"
},
{
"path": "data_structures/dynamic_array/dynamic_array.h",
"chars": 662,
"preview": "#ifndef __DYNAMIC_ARRAY__\n#define __DYNAMIC_ARRAY__\n#define DEFAULT_CAPACITY 1 << 4\n#define INDEX_OUT_OF_BOUNDS NULL\n\nty"
},
{
"path": "data_structures/dynamic_array/main.c",
"chars": 550,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include \"dynamic_array.h\"\n\nint main()\n{\n dynamic_array_t *da = init_dynamic_a"
},
{
"path": "data_structures/graphs/Makefile",
"chars": 2832,
"preview": "CC=gcc \nCFLAGS=-Wall -Werror -std=c99\nall: BFS Bellman-Ford DFS Dijkstra Floyd-Warshall bfsQueue dfsRecursive euler hami"
},
{
"path": "data_structures/graphs/bellman_ford.c",
"chars": 3338,
"preview": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// Structure for storing edge\nstruct Edg"
},
{
"path": "data_structures/graphs/bfs.c",
"chars": 4720,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#define SIZE 40\n// Assume max size of graph is 40 nodes\nstruct queue\n{\n int it"
},
{
"path": "data_structures/graphs/bfs_queue.c",
"chars": 3274,
"preview": "#include <stdbool.h>\n#include <stdio.h>\n#include \"Graph.h\"\n#include \"queue.h\"\n\n#define MAX_NODES 1000\n\nint visited[MAX_N"
},
{
"path": "data_structures/graphs/dfs.c",
"chars": 3448,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\n// A vertex of the graph\nstruct node\n{\n int vertex;\n struct node *next;\n};"
},
{
"path": "data_structures/graphs/dfs_recursive.c",
"chars": 2936,
"preview": "#include <stdbool.h>\n#include <stdio.h>\n#include \"Graph.h\"\n\n#define MAX_NODES 1000\n\nint visited[MAX_NODES]; // array to"
},
{
"path": "data_structures/graphs/dijkstra.c",
"chars": 2961,
"preview": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// Structure for storing a graph\nstruct "
},
{
"path": "data_structures/graphs/euler.c",
"chars": 2927,
"preview": "#include <stdbool.h>\n#include <stdio.h>\n#include \"Graph.h\"\n\n// Return the number of vertices that v is\n// connected to\ni"
},
{
"path": "data_structures/graphs/floyd_warshall.c",
"chars": 2822,
"preview": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// Structure for storing a graph\nstruct "
},
{
"path": "data_structures/graphs/graph.c",
"chars": 3351,
"preview": "// Graph ADT\n// Adjacency Matrix Representation\n#include \"Graph.h\"\n#include <assert.h>\n#include <stdio.h>\n#include <stdl"
},
{
"path": "data_structures/graphs/graph.h",
"chars": 1833,
"preview": "// Graph ADT interface ... COMP2521\n#include <stdbool.h>\n\ntypedef struct GraphRep *Graph;\n\n// vertices are ints\ntypedef "
},
{
"path": "data_structures/graphs/hamiltonian.c",
"chars": 3077,
"preview": "#include <stdbool.h>\n#include <stdio.h>\n#include \"Graph.h\"\n\n#define MAX_NODES 1000\n\nbool visited[MAX_NODES];\n\nbool hamil"
},
{
"path": "data_structures/graphs/kruskal.c",
"chars": 4995,
"preview": "// C program for Kruskal's algorithm to find Minimum Spanning Tree\n// of a given connected, undirected and weighted grap"
},
{
"path": "data_structures/graphs/queue.c",
"chars": 2764,
"preview": "// Queue ADT implementation ... COMP2521\n\n#include \"queue.h\"\n#include <assert.h>\n#include <stdlib.h>\n\ntypedef struct nod"
},
{
"path": "data_structures/graphs/queue.h",
"chars": 1810,
"preview": "// Queue ADT header file ... COMP2521\n\ntypedef struct QueueRep *queue;\n\nqueue newQueue(); // set up empty "
},
{
"path": "data_structures/graphs/strongly_connected_components.c",
"chars": 5941,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#define MAX_SIZE 40 // Assume 40 nodes at max in graph\n#define INT_MIN 0\n// A ve"
},
{
"path": "data_structures/graphs/topological_sort.c",
"chars": 4552,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#define MAX_SIZE 40 // Assume 40 nodes at max in graph\n#define INT_MIN 0\n// A ve"
},
{
"path": "data_structures/graphs/transitive_closure.c",
"chars": 2144,
"preview": "#include <stdbool.h>\n#include <stdio.h>\n\n#define NODES 4\n\nint digraph[NODES][NODES] = {\n {0, 1, 1, 1}, {1, 0, 1, 0}, "
},
{
"path": "data_structures/hash_set/Makefile",
"chars": 156,
"preview": "CC = gcc\nCFLAGS = -g -Wall\n\nall: main\n\nmain: main.o hash_set.o\n\t$(CC) $(CFLAGS) $^ -o $@\n\nhash_set.o: hash_set.c\n\t$(CC) "
},
{
"path": "data_structures/hash_set/hash_set.c",
"chars": 2278,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\n#include \"hash_set.h\"\n\nextern hash_set_t *init_hash_set()\n{\n hash_set_t *set "
},
{
"path": "data_structures/hash_set/hash_set.h",
"chars": 717,
"preview": "#ifndef __HASH_SET__\n#define __HASH_SET__\n\n#define DEFAULT_HASH_SET_CAPACITY 1 << 10\n\ntypedef struct\n{\n unsigned capa"
},
{
"path": "data_structures/hash_set/main.c",
"chars": 1372,
"preview": "#include <stdio.h>\n\n#include \"hash_set.h\"\n\nint main()\n{\n hash_set_t *set = init_hash_set();\n\n int v1 = 10, v2 = 20"
},
{
"path": "data_structures/heap/max_heap.c",
"chars": 4068,
"preview": "#include <limits.h> /// for INT_MIN\n#include <stdio.h> /// for IO operations\n#include <stdlib.h> /// for dynamic mem"
},
{
"path": "data_structures/heap/min_heap.c",
"chars": 3972,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct min_heap\n{\n int *p;\n int size;\n int count;\n} Heap;\n\nHeap"
},
{
"path": "data_structures/linked_list/ascending_priority_queue.c",
"chars": 5146,
"preview": "/* Ascending priority queue using Linked List - Program to implement Ascending\n * priority queue using Linked List */\n\n/"
},
{
"path": "data_structures/linked_list/circular_doubly_linked_list.c",
"chars": 7578,
"preview": "/**\n * @file\n *\n * @details\n * Circular [Doubly Linked\n * List](https://en.wikipedia.org/wiki/Doubly_linked_list) combin"
},
{
"path": "data_structures/linked_list/circular_linked_list.c",
"chars": 3357,
"preview": "/* Circularly Linked List (Basic Operations) - Program to create a Circularly linked list abstract data type and perform"
},
{
"path": "data_structures/linked_list/doubly_linked_list.c",
"chars": 7373,
"preview": "/**\n * @file\n * @brief Implementation of [Doubly linked list](https://en.wikipedia.org/wiki/Doubly_linked_list)\n * @deta"
},
{
"path": "data_structures/linked_list/merge_linked_lists.c",
"chars": 2792,
"preview": "#include <stdio.h>\n#include <stdlib.h>\nstruct node\n{\n int data;\n struct node *next;\n};\n\nstruct node *head1 = NULL;"
},
{
"path": "data_structures/linked_list/middle_element_in_list.c",
"chars": 1378,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\n/* Link list node */\nstruct Node\n{\n int data;\n struct Node *next;\n};\n\n/* F"
},
{
"path": "data_structures/linked_list/queue_linked_list.c",
"chars": 2487,
"preview": "/* Queue using Linked List - Program to create a queue ADT using linked list.\nADT should support the following operation"
},
{
"path": "data_structures/linked_list/singly_link_list_deletion.c",
"chars": 4265,
"preview": "/*Includes structure for a node which can be use to make new nodes of the Linked\n List. It is assumed that the data in "
},
{
"path": "data_structures/linked_list/stack_using_linked_lists.c",
"chars": 1599,
"preview": "#include <stdio.h>\n#include <stdlib.h>\nstruct node\n{\n int info;\n struct node *link;\n};\nstruct node *top = NULL, *t"
},
{
"path": "data_structures/list/Makefile",
"chars": 153,
"preview": "CC = gcc\nCFLAGS = -g -c -Wall\n\nall: main\nmain: main.o list.o\n\t$(CC) -g main.o list.o -o main\n\nlist.o: list.c\n\t$(CC) $(CF"
},
{
"path": "data_structures/list/list.c",
"chars": 1366,
"preview": "#include \"list.h\"\n#include <assert.h>\n#include <stdarg.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#d"
},
{
"path": "data_structures/list/list.h",
"chars": 417,
"preview": "#ifndef __LIST__\n#define __LIST__\n\n#define L List_T\ntypedef struct L *L;\n\nstruct L\n{\n void *val;\n L next;\n};\n\nexte"
},
{
"path": "data_structures/list/main.c",
"chars": 865,
"preview": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"list.h\"\n\nvoid print_list(char *"
},
{
"path": "data_structures/queue/include.h",
"chars": 671,
"preview": "//////////////////////////////////////////////////////////////////////////////////////\n/// INCLUDES\n\n#include <stdio.h>\n"
},
{
"path": "data_structures/queue/queue.c",
"chars": 1311,
"preview": "////////////////////////////////////////////////////////////////////////////////\n// INCLUDES\n#include \"include.h\";\n\n////"
},
{
"path": "data_structures/stack/README.md",
"chars": 756,
"preview": "# Simple generic Stack\n\nThis is a modular generic stack data-structure. The stack is self growing.\n\n### Content\n\n* stack"
},
{
"path": "data_structures/stack/dynamic_stack.c",
"chars": 6537,
"preview": "/**\n * @file\n *\n * @brief\n * Dynamic [Stack](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)),\n * just like Dyn"
},
{
"path": "data_structures/stack/main.c",
"chars": 2084,
"preview": "// program for stack using array\n#include <stdio.h>\n\nvoid push();\nvoid pop();\nvoid peek();\nvoid update();\nvoid display()"
},
{
"path": "data_structures/stack/parenthesis.c",
"chars": 2464,
"preview": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define SIZE 100\n\nstruct node\n{\n char"
},
{
"path": "data_structures/stack/stack.c",
"chars": 2578,
"preview": "/*\n author: Christian Bender\n\n This is the implementation of the (generic) stack.\n The implementation uses the "
},
{
"path": "data_structures/stack/stack.h",
"chars": 695,
"preview": "/*\n author: Christian Bender\n\n This header represents the public stack-interface.\n The stack is generic and sel"
},
{
"path": "data_structures/stack/stack_linked_list/Makefile",
"chars": 153,
"preview": "CC = gcc\nCFLAGS = -c -Wall\n\nall: main\nmain: main.o stack.o\n\t$(CC) main.o stack.o -o main\n\nstack.o: stack.c\n\t$(CC) $(CFL"
},
{
"path": "data_structures/stack/stack_linked_list/main.c",
"chars": 500,
"preview": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include \"stack.h\"\n\nint main()\n{\n Stack_T stk;\n stk = S"
},
{
"path": "data_structures/stack/stack_linked_list/stack.c",
"chars": 1466,
"preview": "#include \"stack.h\"\n#include <assert.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define T Stack_T\n\nty"
},
{
"path": "data_structures/stack/stack_linked_list/stack.h",
"chars": 297,
"preview": "#ifndef __STACK__\n#define __STACK__\n\n#define T Stack_T\ntypedef struct T *T;\n\nextern T Stack_init(void);\nextern int Stack"
},
{
"path": "data_structures/stack.c",
"chars": 3039,
"preview": "/**\n * Kyler Smith, 2017\n * Stack data structure implementation.\n */\n\n//////////////////////////////////////////////////"
},
{
"path": "data_structures/trie/dictionary.txt",
"chars": 3708453,
"preview": "aa\naaa\naah\naahed\naahing\naahs\naal\naalii\naaliis\naals\naam\naardvark\naardvarks\naardwolf\naardwolves\naargh\naaron\naaronic\naarrgh"
},
{
"path": "data_structures/trie/trie.c",
"chars": 5241,
"preview": "/*------------------Trie Data Structure----------------------------------*/\n/*-------------Implimented for search a word"
},
{
"path": "data_structures/vector.c",
"chars": 4130,
"preview": "/**\n * @file\n * @brief This is a vector implemenation in C. A vector is an expandable array.\n * @details This vector imp"
},
{
"path": "developer_tools/CMakeLists.txt",
"chars": 1292,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "developer_tools/malloc_dbg.c",
"chars": 8679,
"preview": "/**\r\n * @file\r\n * @brief This file contains malloc_dbg, calloc_dbg, free_dbg and printLeaks implementations.\r\n * @author"
},
{
"path": "developer_tools/malloc_dbg.h",
"chars": 1328,
"preview": "/**\r\n * @file\r\n * @brief Header file that contains macros used to replace malloc/calloc and free.\r\n * @details\r\n * Macro"
},
{
"path": "developer_tools/min_printf.h",
"chars": 11557,
"preview": "/**\n * @file\n * @brief Implementation of a [function](https://www.geeksforgeeks.org/variable-length-argument-c) similar "
},
{
"path": "developer_tools/test_malloc_dbg.c",
"chars": 915,
"preview": "/**\n * @file\n * @brief File used to test the malloc_dbg, calloc_dbg and free_dbg functions.\n * @details\n * This file onl"
},
{
"path": "developer_tools/test_min_printf.c",
"chars": 1610,
"preview": "/**\n * @file\n * @brief File used to test min_printf function.\n * @details\n * The test will be executed by comparing the "
},
{
"path": "dynamic_programming/CMakeLists.txt",
"chars": 768,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. The RELATIVE flag "
},
{
"path": "dynamic_programming/lcs.c",
"chars": 3757,
"preview": "/**\n * @file\n * @brief [Longest Common\n * Subsequence](https://en.wikipedia.org/wiki/Longest_common_subsequence_problem)"
},
{
"path": "dynamic_programming/matrix_chain_order.c",
"chars": 2964,
"preview": "/**\n * @file\n * @brief [Matrix Chain\n * Order](https://en.wikipedia.org/wiki/Matrix_chain_multiplication)\n * @details\n *"
},
{
"path": "exercism/README.md",
"chars": 263,
"preview": "# Sample solutions for [exercism.io](http://exercism.io/)\n\nThis directory contains some sample solutions for **exercism."
},
{
"path": "exercism/acronym/acronym.c",
"chars": 1753,
"preview": "#include <ctype.h>\n#include <stdio.h>\n#include <string.h>\n\nchar *abbreviate(const char *phrase)\n{\n char str[80];\n "
},
{
"path": "exercism/acronym/acronym.h",
"chars": 83,
"preview": "#ifndef ACRONYM_H\n#define ACRONYM_H\n\nchar *abbreviate(const char *phrase);\n\n#endif\n"
},
{
"path": "exercism/hello_world/hello_world.c",
"chars": 202,
"preview": "#include \"hello_world.h\"\n#include <stdlib.h>\n#include <string.h>\n\nconst char *hello(void)\n{\n char *ans = strdup(\"Hell"
},
{
"path": "exercism/hello_world/hello_world.h",
"chars": 78,
"preview": "#ifndef HELLO_WORLD_H\n#define HELLO_WORLD_H\n\nconst char *hello(void);\n\n#endif\n"
},
{
"path": "exercism/isogram/isogram.c",
"chars": 1060,
"preview": "#include <stdbool.h>\n#include <string.h>\n\n/*\n is_isogram: returns true if the given string a isogram, otherwise false"
},
{
"path": "exercism/isogram/isogram.h",
"chars": 105,
"preview": "#ifndef ISOGRAM_H\n#define ISOGRAM_H\n\n#include <stdbool.h>\n\nbool is_isogram(const char phrase[]);\n\n#endif\n"
},
{
"path": "exercism/rna_transcription/rna_transcription.c",
"chars": 674,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar *to_rna(const char s[])\n{\n /* determines the length "
},
{
"path": "exercism/rna_transcription/rna_transcription.h",
"chars": 158,
"preview": "#ifndef __RNA_TRANSCRIPTION__H\n#define __RNA_TRANSCRIPTION__H\n\n/* to_rna: compiles a DNA strand in its RNA complement */"
},
{
"path": "exercism/word_count/word_count.c",
"chars": 2343,
"preview": "#include \"word_count.h\"\n#include <string.h>\n\n/*\n word_count: returns the full number of words in the input_text,\n "
},
{
"path": "exercism/word_count/word_count.h",
"chars": 914,
"preview": "#ifndef WORD_COUNT_H\n#define WORD_COUNT_H\n\n#define MAX_WORDS 20 // at most MAX_WORDS can be found in the test input str"
},
{
"path": "games/CMakeLists.txt",
"chars": 908,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "games/hangman.c",
"chars": 8044,
"preview": "/**\n * @file\n * @brief C implementation of [Hangman Game](https://en.wikipedia.org/wiki/Hangman_(game))\n * @details\n * S"
},
{
"path": "games/naval_battle.c",
"chars": 22577,
"preview": "/**\n * @file\n * @author [Carlos Rafael](https://github.com/CarlosZoft)\n * @author [Herick Lima](https://github.com/heric"
},
{
"path": "games/tic_tac_toe.c",
"chars": 9974,
"preview": "/**\n * @file tic-tac-toe.c\n * @author [vivekboss99](github.com/vivekboss99)\n * @author [Krishna Vedala](https://github.c"
},
{
"path": "games/words.txt",
"chars": 54,
"preview": "dog\ncat\ntree\nflower\ntable\nprogramming\nlanguage\ntesting"
},
{
"path": "geometry/CMakeLists.txt",
"chars": 860,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "geometry/geometry_datatypes.h",
"chars": 2464,
"preview": "/**\n * @addtogroup quaternions Library for 3D Vectors & Quaternions\n * @{\n * @file\n * @brief Generic header that provide"
},
{
"path": "geometry/quaternions.c",
"chars": 5441,
"preview": "/**\n * @file\n * @brief Functions related to 3D quaternions and Euler angles.\n * @author Krishna Vedala\n */\n\n#include <st"
},
{
"path": "geometry/vectors_3d.c",
"chars": 6481,
"preview": "/**\n * @file\n * @brief Functions related to 3D vector operations.\n * @author Krishna Vedala\n */\n\n#include <stdio.h>\n#ifd"
},
{
"path": "graphics/CMakeLists.txt",
"chars": 3894,
"preview": "find_package(OpenGL)\nif(OpenGL_FOUND)\n find_package(GLUT)\n if(NOT GLUT_FOUND)\n message(\"FreeGLUT library wi"
},
{
"path": "graphics/spirograph.c",
"chars": 8604,
"preview": "/**\n * @file\n * @author [Krishna Vedala](https://github.com/kvedala)\n * @brief Implementation of\n * [Spirograph](https:/"
},
{
"path": "greedy_approach/dijkstra.c",
"chars": 1390,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n\n#define MAX 20\n#define INF 999\n\nint mat[MAX][MAX];\nint V;\n\nint dist[MAX];\n\nint q"
},
{
"path": "greedy_approach/prim.c",
"chars": 4811,
"preview": "/**\n * @file\n * @author [Timothy Maloney](https://github.com/sl1mb0)\n * @brief [Prim's algorithm](https://en.wikipedia.o"
},
{
"path": "hash/CMakeLists.txt",
"chars": 857,
"preview": "# If necessary, use the RELATIVE flag, otherwise each source file may be listed\n# with full pathname. RELATIVE may makes"
},
{
"path": "hash/README.md",
"chars": 95,
"preview": "# Hash algorithms\n\n* sdbm\n* djb2\n* xor8 (8 bit)\n* adler_32 (32 bit)\n* crc32 (32 bit)\n* BLAKE2b\n"
},
{
"path": "hash/hash_adler32.c",
"chars": 1093,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file hash_adler32.c\n * @author [Christian Bender](https://github.com/c"
},
{
"path": "hash/hash_blake2b.c",
"chars": 16001,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file\n * @author [Daniel Murrow](https://github.com/dsmurrow)\n * @brief"
},
{
"path": "hash/hash_crc32.c",
"chars": 1176,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file hash_crc32.c\n * @author [Christian Bender](https://github.com/chr"
},
{
"path": "hash/hash_djb2.c",
"chars": 1017,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file hash_djb2.c\n * @author [Christian Bender](https://github.com/chri"
},
{
"path": "hash/hash_sdbm.c",
"chars": 1015,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file hash_sdbm.c\n * @author [Christian Bender](https://github.com/chri"
},
{
"path": "hash/hash_xor8.c",
"chars": 989,
"preview": "/**\n * @addtogroup hash Hash algorithms\n * @{\n * @file hash_xor8.c\n * @author [Christian Bender](https://github.com/chri"
},
{
"path": "leetcode/DIRECTORY.md",
"chars": 29677,
"preview": "\n# LeetCode\n\n### LeetCode Algorithm\n\n| # | Title "
},
{
"path": "leetcode/README.md",
"chars": 2642,
"preview": "# 📚 Contributing 📚\n\nWe're glad you're interested in adding C LeetCode solutions to the repository.\\\nHere we'll be explai"
},
{
"path": "leetcode/src/1.c",
"chars": 402,
"preview": "int *twoSum(int *nums, int numsSize, int target, int *returnSize)\n{\n int i, j;\n int *ret = calloc(2, sizeof(int));"
},
{
"path": "leetcode/src/10.c",
"chars": 1473,
"preview": "/*\nPrompt:\n\nGiven an input string s and a pattern p, implement regular expression matching with support for '.' and '*' "
},
{
"path": "leetcode/src/1008.c",
"chars": 870,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * struct TreeNode *left;\n * stru"
},
{
"path": "leetcode/src/1009.c",
"chars": 364,
"preview": "// Bit manipulation.\r\n// - Find the bit length of n using log2\r\n// - Create bit mask of bit length of n\r\n// - Retun ~n a"
},
{
"path": "leetcode/src/101.c",
"chars": 549,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * struct TreeNode *left;\n * stru"
},
{
"path": "leetcode/src/1019.c",
"chars": 709,
"preview": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * struct ListNode *next;\n * };\n */\n\n"
},
{
"path": "leetcode/src/1026.c",
"chars": 1049,
"preview": "/**\r\n * Definition for a binary tree node.\r\n * struct TreeNode {\r\n * int val;\r\n * struct TreeNode *left;\r\n * "
},
{
"path": "leetcode/src/104.c",
"chars": 401,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * struct TreeNode *left;\n * stru"
},
{
"path": "leetcode/src/108.c",
"chars": 726,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * struct TreeNode *left;\n * stru"
},
{
"path": "leetcode/src/1089.c",
"chars": 460,
"preview": "void duplicateZeros(int *arr, int arrSize)\n{\n int i, start = 0;\n int *tmp = malloc(arrSize * sizeof(int));\n /* "
},
{
"path": "leetcode/src/109.c",
"chars": 618,
"preview": "struct TreeNode *buildBST(struct ListNode *head, struct ListNode *tail)\n{\n if (head == tail)\n return NULL;\n "
},
{
"path": "leetcode/src/11.c",
"chars": 671,
"preview": "// Fucntion to calculate min of values a and b\nint min(int a, int b) { return ((a < b) ? a : b); }\n\n// Two pointer appro"
},
{
"path": "leetcode/src/110.c",
"chars": 457,
"preview": "int max(int a, int b) { return a >= b ? a : b; }\n\nint height(struct TreeNode *root)\n{\n if (root == NULL)\n retu"
},
{
"path": "leetcode/src/112.c",
"chars": 278,
"preview": "bool hasPathSum(struct TreeNode *root, int sum)\n{\n if (root == NULL)\n return 0;\n if (!root->left && !root->"
},
{
"path": "leetcode/src/1137.c",
"chars": 435,
"preview": "// Dynamic Programming\r\n// Runtime: O(n)\r\n// Space: O(1)\r\nint tribonacci(int n){\r\n int t0 = 0;\r\n int t1 = 1;\r\n "
}
]
// ... and 297 more files (download for full content)
About this extraction
This page contains the full source code of the TheAlgorithms/C GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 497 files (4.7 MB), approximately 1.3M tokens, and a symbol index with 1609 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.