From d59e62223a8511b3707707bde5225477533bcd01 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Fri, 15 Oct 2021 16:23:26 +0000 Subject: [PATCH] Documentation for 229260698981eebc4ffc015a2327bb57bee2cced --- d3/dbb/kadanes3_8cpp__incl.map | 7 + d3/dbb/kadanes3_8cpp__incl.md5 | 1 + d3/dbb/kadanes3_8cpp__incl.svg | 82 +++++ d5/d88/md__d_i_r_e_c_t_o_r_y.html | 1 + de/dcd/kadanes3_8cpp.html | 294 ++++++++++++++++++ de/dcd/kadanes3_8cpp.js | 6 + ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 4 + ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 1 + ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 37 +++ ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 5 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 1 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 52 ++++ dir_9510827d0b234b3cc54b29892f217477.html | 3 + dir_9510827d0b234b3cc54b29892f217477.js | 1 + files.html | 27 +- globals_func_m.html | 3 +- globals_func_t.html | 2 +- globals_m.html | 3 +- globals_p.html | 2 +- globals_t.html | 2 +- namespacemembers.html | 4 +- namespacemembers_func.html | 4 +- navtreedata.js | 2 +- navtreeindex0.js | 60 ++-- navtreeindex1.js | 44 +-- navtreeindex10.js | 32 +- navtreeindex11.js | 80 ++--- navtreeindex12.js | 48 +-- navtreeindex13.js | 88 +++--- navtreeindex2.js | 78 ++--- navtreeindex3.js | 56 ++-- navtreeindex4.js | 72 ++--- navtreeindex5.js | 54 ++-- navtreeindex6.js | 56 ++-- navtreeindex7.js | 86 ++--- navtreeindex8.js | 40 +-- navtreeindex9.js | 58 ++-- search/all_11.js | 4 +- search/all_12.js | 4 +- search/all_15.js | 26 +- search/all_a.js | 89 +++--- search/all_c.js | 35 ++- search/all_e.js | 219 ++++++------- search/files_b.js | 11 +- search/functions_11.js | 4 +- search/functions_14.js | 4 +- search/functions_9.js | 192 ++++++------ search/functions_d.js | 149 ++++----- 48 files changed, 1319 insertions(+), 814 deletions(-) create mode 100644 d3/dbb/kadanes3_8cpp__incl.map create mode 100644 d3/dbb/kadanes3_8cpp__incl.md5 create mode 100644 d3/dbb/kadanes3_8cpp__incl.svg create mode 100644 de/dcd/kadanes3_8cpp.html create mode 100644 de/dcd/kadanes3_8cpp.js create mode 100644 de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map create mode 100644 de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 create mode 100644 de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg create mode 100644 de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map create mode 100644 de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 create mode 100644 de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg diff --git a/d3/dbb/kadanes3_8cpp__incl.map b/d3/dbb/kadanes3_8cpp__incl.map new file mode 100644 index 000000000..20ff12346 --- /dev/null +++ b/d3/dbb/kadanes3_8cpp__incl.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/d3/dbb/kadanes3_8cpp__incl.md5 b/d3/dbb/kadanes3_8cpp__incl.md5 new file mode 100644 index 000000000..2ff8ae30f --- /dev/null +++ b/d3/dbb/kadanes3_8cpp__incl.md5 @@ -0,0 +1 @@ +c437417ec63a278b3cf13af4c2abfe92 \ No newline at end of file diff --git a/d3/dbb/kadanes3_8cpp__incl.svg b/d3/dbb/kadanes3_8cpp__incl.svg new file mode 100644 index 000000000..6891ad928 --- /dev/null +++ b/d3/dbb/kadanes3_8cpp__incl.svg @@ -0,0 +1,82 @@ + + + + + + +others/kadanes3.cpp + + + +Node1 + + +others/kadanes3.cpp + + + + + +Node2 + + +array + + + + + +Node1->Node2 + + + + + +Node3 + + +cassert + + + + + +Node1->Node3 + + + + + +Node4 + + +climits + + + + + +Node1->Node4 + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + + + diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index 7763d624e..701ec742d 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -376,6 +376,7 @@ Others
  • Fast Integer Input
  • Happy Number
  • Iterative Tree Traversals
  • +
  • Kadanes3
  • Lru Cache
  • Matrix Exponentiation
  • Palindrome Of Number
  • diff --git a/de/dcd/kadanes3_8cpp.html b/de/dcd/kadanes3_8cpp.html new file mode 100644 index 000000000..6ccea7b25 --- /dev/null +++ b/de/dcd/kadanes3_8cpp.html @@ -0,0 +1,294 @@ + + + + + + + +Algorithms_in_C++: others/kadanes3.cpp File Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    kadanes3.cpp File Reference
    +
    +
    + +

    Efficient implementation for maximum contiguous subarray sum by Kadane's algorithm. +More...

    +
    #include <array>
    +#include <cassert>
    +#include <climits>
    +#include <iostream>
    +
    +Include dependency graph for kadanes3.cpp:
    +
    +
    +
    +
    +
    + + + + + + + + + + + +

    +Functions

    template<std::size_t SIZE>
    int max_subarray_sum (std::array< int64_t, SIZE > arr, uint64_t length)
     for IO operations More...
     
    static void test ()
     Self-test implementations. More...
     
    int main ()
     Main function. More...
     
    +

    Detailed Description

    +

    Efficient implementation for maximum contiguous subarray sum by Kadane's algorithm.

    +

    Our task is to take length of array and then the whole array as input from the user and then calculate the maximum contiguos subarray sum for the input array, using the kadane's algorithm.

    +

    There can be a case that all the elements in the input array are negative. In that case, the least value among all elements is the maximum sum with subarray length = 1.

    Author
    Abhijeet Tiwari
    +

    Function Documentation

    + +

    ◆ main()

    + +
    +
    + + + + + + + + +
    int main (void )
    +
    + +

    Main function.

    +
    Returns
    0 on exit
    +
    60 {
    +
    61 // Below is the code for accepting array from the user and then
    +
    62 // calling the function for the required output.
    +
    63 // It has been commented for now so that the test() function can run
    +
    64 // and the test cases can be verified.
    +
    65 // code for accepting array from user starts
    +
    66
    +
    67 // std::size_t n; // variable for length of input array
    +
    68 // std::cout << "Enter length of the array: ";
    +
    69 // std::cin >> n;
    +
    70 // std::array<int64_t, 100> arr = {0};
    +
    71 // // we need to give a constant in size. Hence we have allocated 100
    +
    72 // for now.
    +
    73 // for (int i = 0; i < n; i++)
    +
    74 // taking input of each element of the array
    +
    75 // {
    +
    76 // std::cin >> arr[i];
    +
    77 // }
    +
    78 // code for accepting array from user ends
    +
    79
    +
    80 // int max_sum = max_subarray_sum(arr, n);
    +
    81 // std::cout << "Maximum contiguous sum for this array is : " << max_sum
    +
    82 // << std::endl;
    +
    83
    +
    84 test(); // run self-test implementations
    +
    85 return 0;
    +
    86}
    +
    static void test()
    Self-test implementations.
    Definition: kadanes3.cpp:48
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ max_subarray_sum()

    + +
    +
    +
    +template<std::size_t SIZE>
    + + + + + + + + + + + + + + + + + + +
    int max_subarray_sum (std::array< int64_t, SIZE > arr,
    uint64_t length 
    )
    +
    + +

    for IO operations

    +

    for std::array for assert for INT_MIN value

    +

    Utility function to check the current maximum number

    Parameters
    + + + +
    arrinput array
    lengthlength of the input array
    +
    +
    +
    Returns
    maximum contiguous subarray sum
    +
    29 {
    +
    30 int64_t current_max = INT_MIN, current_sum = 0;
    +
    31 for (int i = 0; i < length; i++) {
    +
    32 current_sum = current_sum + arr[i];
    +
    33 if (current_max < current_sum) {
    +
    34 current_max = current_sum;
    +
    35 }
    +
    36
    +
    37 if (current_sum < 0) {
    +
    38 current_sum = 0;
    +
    39 }
    +
    40 }
    +
    41 return current_max;
    +
    42}
    +
    +
    +
    + +

    ◆ test()

    + +
    +
    + + + + + +
    + + + + + + + +
    static void test ()
    +
    +static
    +
    + +

    Self-test implementations.

    +
    Returns
    void
    +
    48 {
    +
    49 std::array<int64_t, 4> arr = {1, 2, 3, 4};
    +
    50 std::array<int64_t, 5> arr1 = {-1, -2, -4, -6, 7};
    +
    51 assert(max_subarray_sum(arr, 4) == 10);
    +
    52 assert(max_subarray_sum(arr1, 5) == 7);
    +
    53 std::cout << "All test cases have passed!\n";
    +
    54}
    + + +
    int max_subarray_sum(std::array< int64_t, SIZE > arr, uint64_t length)
    for IO operations
    Definition: kadanes3.cpp:29
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +
    +
    + + + + diff --git a/de/dcd/kadanes3_8cpp.js b/de/dcd/kadanes3_8cpp.js new file mode 100644 index 000000000..00c8ddbd6 --- /dev/null +++ b/de/dcd/kadanes3_8cpp.js @@ -0,0 +1,6 @@ +var kadanes3_8cpp = +[ + [ "main", "de/dcd/kadanes3_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "max_subarray_sum", "de/dcd/kadanes3_8cpp.html#a338439a04148ae89f695595acfa5c147", null ], + [ "test", "de/dcd/kadanes3_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map new file mode 100644 index 000000000..e39373f46 --- /dev/null +++ b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 new file mode 100644 index 000000000..6fd663c45 --- /dev/null +++ b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -0,0 +1 @@ +aa01d8c56a53417e0431b59484bae7ca \ No newline at end of file diff --git a/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg new file mode 100644 index 000000000..12d822ec6 --- /dev/null +++ b/de/dcd/kadanes3_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -0,0 +1,37 @@ + + + + + + +test + + + +Node1 + + +test + + + + + +Node2 + + +max_subarray_sum + + + + + +Node1->Node2 + + + + + diff --git a/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..de78d38cc --- /dev/null +++ b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..97b3547c2 --- /dev/null +++ b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +23089012b98caafc9c99377fd60bd343 \ No newline at end of file diff --git a/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..766d7ccbd --- /dev/null +++ b/de/dcd/kadanes3_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,52 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + +Node3 + + +max_subarray_sum + + + + + +Node2->Node3 + + + + + diff --git a/dir_9510827d0b234b3cc54b29892f217477.html b/dir_9510827d0b234b3cc54b29892f217477.html index af05f29ca..63c19ad79 100644 --- a/dir_9510827d0b234b3cc54b29892f217477.html +++ b/dir_9510827d0b234b3cc54b29892f217477.html @@ -117,6 +117,9 @@ Files file  iterative_tree_traversals.cpp  Iterative version of Preorder, Postorder, and preorder Traversal of the Tree
      +file  kadanes3.cpp + Efficient implementation for maximum contiguous subarray sum by Kadane's algorithm.
    +  file  lru_cache.cpp  An implementation of LRU Cache. Lru is a part of cache algorithms (also frequently called cache replacement algorithms or cache replacement policies).
      diff --git a/dir_9510827d0b234b3cc54b29892f217477.js b/dir_9510827d0b234b3cc54b29892f217477.js index 1713cec5b..33b69b8e8 100644 --- a/dir_9510827d0b234b3cc54b29892f217477.js +++ b/dir_9510827d0b234b3cc54b29892f217477.js @@ -7,6 +7,7 @@ var dir_9510827d0b234b3cc54b29892f217477 = [ "fast_integer_input.cpp", "d9/df0/fast__integer__input_8cpp.html", "d9/df0/fast__integer__input_8cpp" ], [ "happy_number.cpp", "db/df3/happy__number_8cpp.html", "db/df3/happy__number_8cpp" ], [ "iterative_tree_traversals.cpp", "d8/d90/iterative__tree__traversals_8cpp.html", "d8/d90/iterative__tree__traversals_8cpp" ], + [ "kadanes3.cpp", "de/dcd/kadanes3_8cpp.html", "de/dcd/kadanes3_8cpp" ], [ "lru_cache.cpp", "d3/db3/lru__cache_8cpp.html", "d3/db3/lru__cache_8cpp" ], [ "matrix_exponentiation.cpp", "d7/d35/matrix__exponentiation_8cpp.html", "d7/d35/matrix__exponentiation_8cpp" ], [ "palindrome_of_number.cpp", "da/d9a/palindrome__of__number_8cpp.html", "da/d9a/palindrome__of__number_8cpp" ], diff --git a/files.html b/files.html index 70d7de1e7..ce47805d5 100644 --- a/files.html +++ b/files.html @@ -273,19 +273,20 @@ solve-a-rat-in-a-maze-c-java-pytho/"  fast_integer_input.cppRead integers from stdin continuously as they are entered without waiting for the \n character  happy_number.cppA happy number is a number whose sum of digits is calculated until the sum is a single digit, and this sum turns out to be 1  iterative_tree_traversals.cppIterative version of Preorder, Postorder, and preorder Traversal of the Tree - lru_cache.cppAn implementation of LRU Cache. Lru is a part of cache algorithms (also frequently called cache replacement algorithms or cache replacement policies) - matrix_exponentiation.cppMatrix Exponentiation - palindrome_of_number.cppCheck if a number is palindrome or not - paranthesis_matching.cppPerform paranthesis matching - pascal_triangle.cppPascal's triangle implementation - postfix_evaluation.cppEvaluation of Postfix Expression - primality_test.cppPrimality test implementation - smallest_circle.cppGet centre and radius of the smallest circle that circumscribes given set of points - sparse_matrix.cpp - spiral_print.cppPrint the elements of a matrix traversing it spirally - stairs_pattern.cppThis program is use to print the following pattern - tower_of_hanoi.cppSolve the Tower of Hanoi problem - vector_important_functions.cppA C++ program to demonstrate working of std::sort(), std::reverse() + kadanes3.cppEfficient implementation for maximum contiguous subarray sum by Kadane's algorithm + lru_cache.cppAn implementation of LRU Cache. Lru is a part of cache algorithms (also frequently called cache replacement algorithms or cache replacement policies) + matrix_exponentiation.cppMatrix Exponentiation + palindrome_of_number.cppCheck if a number is palindrome or not + paranthesis_matching.cppPerform paranthesis matching + pascal_triangle.cppPascal's triangle implementation + postfix_evaluation.cppEvaluation of Postfix Expression + primality_test.cppPrimality test implementation + smallest_circle.cppGet centre and radius of the smallest circle that circumscribes given set of points + sparse_matrix.cpp + spiral_print.cppPrint the elements of a matrix traversing it spirally + stairs_pattern.cppThis program is use to print the following pattern + tower_of_hanoi.cppSolve the Tower of Hanoi problem + vector_important_functions.cppA C++ program to demonstrate working of std::sort(), std::reverse()   probability  addition_rule.cppAddition rule of probabilities  bayes_theorem.cppBayes' theorem diff --git a/globals_func_m.html b/globals_func_m.html index 5fac9d623..568dd0617 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -93,8 +93,9 @@ $(document).ready(function(){initNavTree('globals_func_m.html',''); initResizabl  

    - m -