Wednesday, 19 December 2012

What is the major difference b/w 32-bit and 64-bit processor ??

At any time processor can execute only one machine instruction, and that instruction length is 32 bits in 32-bit processor and 64 bits in 64-bit processor.

The memory addresses represented by a 32-bit processor is 2power32(2^32) where as 2power64(2^64) in case of 64-bit processor.since 64-bit processor has more memory address, it can even load entire program into memory and executes the program by reducing the overhead of Disk I/O cycles, thereby increasing the performance.

(if not entire program, 64-bit processor will have large "frame" size compared to 32-bit. so it can execute the program in less Disk I/O cycles) 

Cards Game Puzzle

Puzzle:- This puzzle is a game related one. Consider a game contains two participants(let is say player,comp) there are 21 cards in total and each participant can pick either 1 or 2 or 3 or 4 cards at a time. In every game first chance of picking cards is given to player and whoever takes the last card(here 21st card) will be the looser. solve the puzzle such that always comp should win the game.

if player picks x cards then computer should pick 5-x cards each round.
after four rounds 5*4 = 20 cards will be picked up then the player turn will come, as rule says he should pick atleast one card, so picks up the last card and looses the game.
this is the algorithm for which always computer will win the game.

Missing Ball Puzzle

This is one of the famous puzzles asked in interviews.

Puzzle: There are total hundred balls in a bag, numbered from 1..100(no two balls will have same number).From that bag one ball is stolen by a thief and you will be given that bag with remaining 99 balls. so you need to findout the missing ball in a better way?


step1:- calculate the sum of hundred balls. use some of n numbers formula n*(n+1)/2.  i.e., ActualCount.

step2:- calculate the sum of remaining 99 balls.   i.e.,  ObtainedCount

step3:- missing ball number = ActualCount - ObtainedCount

If you have better solutions..please share them in comments!!