Find two items

B

Busin

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!
 
E

Emmanuel Delahaye

Busin said:
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"?

How an algorithm question is a C question at all ?
 
J

Jack Klein

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.
 
P

Prawit Chaivong

Busin said:
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!

Hi Busin.
In fact, I'm interesting in you question BUT unfortunately I can't
understand your question exactly. It would be nice if you could
explain a little bit more.

Regards,
Prawit Chaivong
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,369
Latest member
FTMZ

Latest Threads

Top