473,394 Members | 1,724 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,394 software developers and data experts.

Algorithm newsgroup?

Where do I find an algorithm newsgroup?

I am interested in getting some help with the "even parity check" algorithm.
I used google to find this back in 1999 from this newsgroup:

unsigned parity(unsigned arg)
{
unsigned a = arg;

a ^= a >> 16;
a ^= a >> 8;
a ^= a >> 4;
a ^= a >> 2;
a ^= a >> 1;

return a & 1;
}

Who have invented this algorithm?

Is it possible to find an explanation somewhere because I see that it works
but would never myself have come up with it and would very much like to
know the theory behind it.
Nov 15 '05 #1
7 1249
"Paminu" <ja******@asd.com> wrote in message
news:dh**********@news.net.uni-c.dk...
Where do I find an algorithm newsgroup?
I can only suggest a Russian one, fido7.ru.algorithms which would work for
you only through a FIDO gateway and anyway most people there are Russian
speaking, so, I'm not sure you'll find it suitable for you... :(
I am interested in getting some help with the "even parity check" algorithm. I used google to find this back in 1999 from this newsgroup:

unsigned parity(unsigned arg)
{
unsigned a = arg;

a ^= a >> 16;
a ^= a >> 8;
a ^= a >> 4;
a ^= a >> 2;
a ^= a >> 1;

return a & 1;
}

Who have invented this algorithm?
I have. Some Mr. John Brown has. Many people have invented that on their own
independently.
Is it possible to find an explanation somewhere because I see that it works but would never myself have come up with it and would very much like to
know the theory behind it.


The explanation is simple: you XOR all bits of the number to get a single
bit in the end. The above does it very well, and w/o an unnecessary loop, I
must say.
But this is all Off Topic in this group as you may know... So, I'm shutting
up right here (had to do that in the beginning though).

Alex
Nov 15 '05 #2
Alexei A. Frounze wrote:
"Paminu" <ja******@asd.com> wrote in message
news:dh**********@news.net.uni-c.dk...
Where do I find an algorithm newsgroup?


I can only suggest a Russian one, fido7.ru.algorithms which would work for
you only through a FIDO gateway and anyway most people there are Russian
speaking, so, I'm not sure you'll find it suitable for you... :(
I am interested in getting some help with the "even parity check"

algorithm.
I used google to find this back in 1999 from this newsgroup:

unsigned parity(unsigned arg)
{
unsigned a = arg;

a ^= a >> 16;
a ^= a >> 8;
a ^= a >> 4;
a ^= a >> 2;
a ^= a >> 1;

return a & 1;
}

Who have invented this algorithm?


I have. Some Mr. John Brown has. Many people have invented that on their
own independently.
Is it possible to find an explanation somewhere because I see that it

works
but would never myself have come up with it and would very much like to
know the theory behind it.


The explanation is simple: you XOR all bits of the number to get a single
bit in the end. The above does it very well, and w/o an unnecessary loop,
I must say.
But this is all Off Topic in this group as you may know... So, I'm
shutting up right here (had to do that in the beginning though).

Alex

hmm but since there is only russian newsgroups covering algorithms would
this group not be the most obvious group to discuss these kind of issues?

If not is there any other alternatives?
Nov 15 '05 #3
Paminu wrote:
unsigned a = arg;

a ^= a >> 16;


That's undefined if UCHAR_MAX equals 0xffffu.

--
pete
Nov 15 '05 #4
Paminu wrote:

Alexei A. Frounze wrote:
"Paminu" <ja******@asd.com> wrote in message
news:dh**********@news.net.uni-c.dk...
Where do I find an algorithm newsgroup?


news:comp.programming

--
pete
Nov 15 '05 #5
pete wrote:
Paminu wrote:

unsigned a = arg;

a ^= a >> 16;

That's undefined if UCHAR_MAX equals 0xffffu.

UINT_MAX, of course.

And although you're right, we presumably aren't supposed to care.
Otherwise a loop *would* be more appropriate, to accommodate unsigned
ints of arbitrary sizes.

S.
Nov 15 '05 #6
"Paminu" <ja******@asd.com> wrote in message
news:di**********@news.net.uni-c.dk...
hmm but since there is only russian newsgroups covering algorithms would
this group not be the most obvious group to discuss these kind of issues?

If not is there any other alternatives?


I simply don't know others. I prefer first to get my own solution, then look
for any hint elsewhere if I don't like mine (e.g. too complicated, too slow)
or if it's just incorrect/incomplete (e.g. doesn't cover the cases which I
don't know at all or don't understand clearly). As for understanding why
something works the way it does, if you have the code/formula for it, you
generally can understand that, not always quickly, however, especially if
either the formal language or the problem at hand (or both) isn't familiar
to you. It all depends on the experience, level of ignorance, logical
reasoning and researching skills, laziness and attitude, or, in other words,
on your past, present and where you want to get with all that in the future.
:)

Alex
Nov 15 '05 #7
Skarmander wrote:

pete wrote:
Paminu wrote:

unsigned a = arg;

a ^= a >> 16;

That's undefined if UCHAR_MAX equals 0xffffu.

UINT_MAX, of course.


Yes.

--
pete
Nov 15 '05 #8

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

Similar topics

17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
4
by: sasha.mal | last post by:
Hello everybody! Could anyone help with a practical graph isomorphism algorithm, coded in C++ (C would also do), to work with genus bounded graphs of a bounded degree. Currently, any...
5
by: junky_fellow | last post by:
How do we calculate the complexity of an algorithm? Am i right if i say the complexity of an algorithm is the number of comparisons done in that algorithm? thanx in advance .......
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
9
by: asaguiar | last post by:
Hi, Given the pseudocode explanation of the Kahan algorithm at http://en.wikipedia.org/wiki/Kahan_summation_algorithm, I tried to implement it in C. It is supposed to minimize the effect of base...
7
by: Wei | last post by:
Hi all, I found out I can use the max function which is defined in STL <algorithmwithout including this header in my program. The compilers I used are GNU g++ 3.4.4 and Visual Studio C++ 2005. ...
3
by: Max Odendahl | last post by:
Hi, I am looking for algorithms to layout rectangles underneath each other in a sidebar. All rectangles have different heights as well as an ankor point. The rectangle can have scrollbars, but...
3
by: gomsi | last post by:
hi, i have a paragraph where i have to insert <markand </marktags to highlight the required words.i am implementing it in c++ i am currently doing it as follows.. i take the corresponding...
1
by: almurph | last post by:
Hi everyone, Concerning the Needleman-Wunsch algorithm (cf. http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm) I have noticed a possible loop. Inside the algorithm there is an...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.