# Bit Tricks

The basic Bit Operations are & (AND) , |(OR) , ^(X-OR), ~(Negation).

Checking nth bit set or not

Let ‘x‘ be the given number.

(x & (1<<n)) >> n

Setting the nth bit of number

x = ( x | (1<<n) )

# Pop Vs Imap Protocol

Both POP3 and IMAP protocol are used for email retrieval process.

# Pop Protocol

• Pop protocol downloads the mail from the server, stores it locally and deletes from the server.
• POP3 is useful only when you access email from only one computer.
• POP3 is a one-way communication.
• All mails are stored locally and without internet connection we can access them.
• When the mail is accidentally deleted, we cannot recover it.

# IMAP Protocol

• IMAP protocol connects the remote server, caches the mail locally and then disconnects from the server.
• IMAP is useful when you want access e-mail from multiple systems.
• IMAP is a 2-way communication

# Puzzle

Consider two trains starting from two points X and Y respectively. Trains which starts from X travels at 15 Km/hr while the train which starts from Y travels at 20 Km/hr. Both trains start at the same time. A Bird also start from X at the same time. The speed of the Bird is 25 Km/hr. The Bird flies from X to Y until it meets the train started from Y. After that it changes its direction and fly towards the train started from X. When it meets X it start flying toward Y and so on until the train meets. What is the total distance covered by the bird ?

Hint : Think Simple !

# Puzzle

A loyal worker is working under you for 7(seven) days and you have only one gold bar to pay him. You must pay the worker at the end of each day. Otherwise, he wont come for next day’s work. One more constraint is you have to make only two cuts in the gold bar. How can you pay him at the end of each day ?

Hint:   Barter System