22 May 2010

Friendship

Friendship isnt about "I am Sorry", but its abt "kaminey sab teri galti hai",
Its not about about "I am here for you", but its about "kaha hai nalayak",
Its not about about "I understand", but its about "sab teri vajah se hua hai manhus",
Its not about about "I care for you", but its about "kamino tumhe chhod kar kaha jaunga",
Its not about about "I am happy for your success", but its about "lukkhe chal party de",
Its not about about "its your fault", but its about "sorry bol chup chap",
Its not about about "can I borrow this", but its about "oye maine le liya",
Its not about about "can I share your tiffin", but its about "tere liye ye thoda chhod diya hai",
Its not about about "how your studies going", but its about "abe kitna padhega",
Its not about about "bas kar kitna likhega", but its about "abe wo ladki ja rahi hai"....


a text from my friend.

15 May 2010

Binary to decimal & viceversa conversion

This technique is useful while solving networks problems.

1. Binary to decimal
Select the first value from left hand side. If its 0, next; if its 1, we start.
If its succeeded by a 0, then double the number (i.e. 1 in this case).
If its succeeded by a 1, then double the number and add 1 to it.

Carry out the same procedure for all digits.

for eg. 11010110
1=>1
(1*2)+1=3          since followed by 1.
3*2=6                 since 0.
(6*2)+1=13       since 1.
(13*2)=26         since 0.
(26*2)+1=53    since 1.
(53*2)+1=107  since 1.
(107*2)=214    since 0.

final answer => 214.

2. Decimal to binary
This is little tricky but not that much you usually do.
Remember the range 128, 64, 32, 16, 8, 4, 2, 1.
The range specifies the position of bits.
For any bit to be 1 or 0, compareit with the remainder, if remainder larger than value put 1 at that position, else put 0.


select any no. say 189
1st  bit=>    is 189 >= 128 ?  yes.      So =>1                           189-128=61
2nd bit=>    is 61   >=   64 ?    no.      So =>0
3rd  bit=>    is 61   >=   32 ?  yes.      So =>1                            61-32=29
4th  bit=>    is 29   >=   16 ?  yes.      So =>1                            29-16=13
5th  bit=>    is 13   >=     8 ?  yes.      So =>1                            13-8=5
6th  bit=>    is 5     >=     4 ?  yes.      So =>1                             5-4=1
7th  bit=>    is 1     >=     2 ?  no.       So =>0
8th  bit=>    is 1     >=    1 ?  yes.      So =>1                              1-1=0

final answer => 10111101

Cross checking : Always remember, the remainder must be zero, then the conversion is correct.