Сделал 13 усовершенствованную с иным заданием
This commit is contained in:
parent
5852a9f034
commit
3f5c6299fc
11 changed files with 146 additions and 5 deletions
|
@ -26,9 +26,9 @@ int searching_loc_min(double * numbers)
|
|||
|
||||
|
||||
for (unsigned i = 2; i < length; ++i) {
|
||||
if (numbers[i] == numbers[i - 1]) {
|
||||
if (fabs(numbers[i] - numbers[i - 1]) < exp) {
|
||||
if (curr_len) ++curr_len;
|
||||
} else if (numbers[i] > numbers[i - 1]) {
|
||||
} else if ((numbers[i] - numbers[i - 1]) > exp) {
|
||||
if (curr_len) {
|
||||
// It is important to remember that numbers[0] is equal to the length of the list!
|
||||
start_end[0 + (min_num * 2)] = (i - curr_len), start_end[1 + (min_num * 2)] = i - 1;
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef LOCAL_MINIMUM
|
||||
#define LOCAL_MINIMUM
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define exp 1.e-6
|
||||
|
||||
int transposition(double * numbers, unsigned * start_end);
|
||||
int searching_loc_min(double * numbers);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue