Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
C++ program for maximum contiguous circular sum problem using Kadane's Algorithm More...
#include <cassert>
#include <iostream>
#include <vector>
Namespaces | |
namespace | dynamic_programming |
Dynamic Programming algorithms. | |
Functions | |
int | dynamic_programming::maxCircularSum (std::vector< int > &arr) |
returns the maximum contiguous circular sum of an array | |
static void | test () |
Self-test implementation. | |
int | main (int argc, char *argv[]) |
Main function. | |
C++ program for maximum contiguous circular sum problem using Kadane's Algorithm
The idea is to modify Kadane’s algorithm to find a minimum contiguous subarray sum and the maximum contiguous subarray sum, then check for the maximum value between the max_value and the value left after subtracting min_value from the total sum. For more information, check Geeks For Geeks explanation page.
int main | ( | int | argc, |
char * | argv[] ) |
Main function.
argc | commandline argument count (ignored) |
argv | commandline array of arguments (ignored) |
|
static |
Self-test implementation.