Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

try to give the logic

Status
Not open for further replies.

kad

Junior Member level 2
Joined
Feb 8, 2005
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
199
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution).
 

What ? Is that an order?

I hope you don't expect anyone to "give" you a ready-made solution...

google for "parity"
 

not an order, just verbatim from the homework assignment - lol!
 

electronrancher said:
not an order, just verbatim from the homework assignment - lol!

Sure looks like a straight lift but cann't resist frm replying

let x be d no. not equal to zero

ans=1
while(x>2)
{
if( x%2!=0) {ans++; x--;}
x=x/2;
}

ans will give the no. of ones

TRY TO UNDERSTAND THE LOGIC AS THATS WHAT MATTERS
 

Hi all

On average there will be 16 - the most probable prediction every time.

Polymath
 

polymath said:
Hi all

On average there will be 16 - the most probable prediction every time.

Polymath

Why should ?
 

tronix said:
polymath said:
Hi all

On average there will be 16 - the most probable prediction every time.

Polymath

Why should ?

Why not? You have not defined your 32 bits as having any structure other than random.

Read about Statistics & Probability.
Noise - Long Comm. Transmissions and many data structures have equal 1s & 0s by chance or design.

yes .. no .. yes .. no ... Polymath
 

Well polymath I think here we r talking abt deterministic coding and not the random ones.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top