diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-10-09 18:49:43 +0200 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-10-09 18:49:43 +0200 |
| commit | 47b3a28f97c2c118b6207a79e146a89fc366c0cd (patch) | |
| tree | 0d7a958121ba6db258d6072c4907499c62ed5603 /math/maxTeilfeld.cpp | |
| parent | 0cd019a2390f028abc5165b0ab0bf80950d85251 (diff) | |
Typesetting in math section.
Diffstat (limited to 'math/maxTeilfeld.cpp')
| -rw-r--r-- | math/maxTeilfeld.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/math/maxTeilfeld.cpp b/math/maxTeilfeld.cpp deleted file mode 100644 index bbafa3f..0000000 --- a/math/maxTeilfeld.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// N := Länge des Feldes. -// Laufzeit: O(N) -int maxStart = 1, maxLen = 0, curStart = 1, len = 0; -double maxValue = 0, sum = 0; -for (int pos = 0; pos < N; pos++) { - sum += values[pos]; - len++; - if (sum > maxValue) { // Neues Maximum. - maxValue = sum; maxStart = curStart; maxLen = len; - } - if (sum < 0) { // Alles zurücksetzen. - curStart = pos +2; len = 0; sum = 0; - } -} -// maxSum := maximaler Wert, maxStart := Startposition, maxLen := Länge der Sequenz |
