Posts filed under 'Algorithm'

The $25,000,000,000 Eigenvector: The Linear Algebra Behind Google

This is a very nice paper about how your page is ranked on google.
Take a look !

http://www.rose-hulman.edu/~bryan/googleFinalVersionFixed.pdf

Add comment December 6, 2006

Swap 2 variables without 3rd variable.

Hey this is quiet interesting in programming.
Typical SWAP functions usually use a 3rd variable to store the value of the one that you want to swap.

Ex:
Given:
X = 10
Y= 20
Result:
X = 20
Y= 10

X = X + Y -> X = 20 + 10 = 30
Y = X - Y -> Y = 30 - 10 = 20
X = X – A –> X = 30 – 20 = 10

You can also do it with the exclusive or bitwise operator

X=(X^=Y)^(Y^=X);

Add comment November 29, 2006


Calendar

November 2009
M T W T F S S
« Sep    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Posts by Month

Posts by Category