bool arr[index_max];
arr[n] = true;
For the element arr[n], is there any fastest algorithm to fast find the two
elements on both side of "n" and both elements are cloest to "23"?
Thanks!
I am having a problem understanding your question, although as
Emmanuel already said, it is an algorithm question and not a language
question.
Exactly what language is this sample code written?
The type 'bool' exists in C if you have a C99 conforming compiler and
have included the <stdbool.h> header.
If you do so, all values that you store into this array will be
automatically converted to Boolean types, that is members of the array
can only contain the values 0 or 1 (equivalent to the macros "false"
and "true" respectively).
How can you find the elements having the closest value to 23? All
true members of the array will have a difference of 22 from the value
23. All false members of the array will have a difference of 23 from
23.
You need to ask algorithm questions in a group like
But you also need to word your question
better.