473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Find two items

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!

Nov 14 '05 #1
3 1360
In 'comp.lang.c', "Busin" <bu****@fidrep.com> wrote:
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 ?

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 14 '05 #2
On Sun, 04 Jul 2004 17:06:03 GMT, "Busin" <bu****@fidrep.com> wrote in
comp.lang.c:
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
news:comp.programming. But you also need to word your question
better.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #3
"Busin" <bu****@fidrep.com> wrote in message news:<%N******************@bgtnsc05-news.ops.worldnet.att.net>...
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
Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
2
by: Ori :) | last post by:
I am writing an application to retrieve appointments from Outlook, I have the appointment items sorted by "Start" field and now I want to find the first record which's "Start" value is later than...
3
by: Jozef Jarosciak | last post by:
Quickest way to find the string in 1 dimensional string array! I have a queue 1 dimensional array of strings called 'queue' and I need a fast way to search it. Once there is match, I don't need...
1
by: Pieter | last post by:
Hi, I have my own custom BindingList, that inherits from BindingList, and implements IComponent. I would like to implement a Find-method, that will allow me to search for a property of my...
16
by: Michael M. | last post by:
How to find the longst element list of lists? I think, there should be an easier way then this: s1 = s2 = s3 = if len(s1) >= len(s2) and len(s1) >= len(s3): sx1=s1 ## s1 ist längster
3
by: jm.suresh | last post by:
Hi, I have a list and I want to find the first element that meets a condition. I do not want to use 'filter', because I want to come out of the iteration as soon as the first element is found. I...
30
by: =?Utf-8?B?VGhvbWFzVDIy?= | last post by:
Hello, I have an array that holds 4 values ( they contain random numbers). I would like to find the lowest value (if there is a tie i would like to find one of the tie.) then remove that value....
6
by: =?Utf-8?B?UGhpbA==?= | last post by:
I have seen the samples for Find that explain how to use the predicate, but they are always searching for a pre-defined value. What I don't understand is how to search for a random value stored in...
3
by: Payne | last post by:
Hello, I'm having trouble figuring out how to best explain my problem but I hope I can make myself clear enough. Anyway, I'm doing an assignment for school and in this one we're supposed to write a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.