Posts

NFA and Qbit comparison

Image
 Question: I feel NFA concept of the NFA being in multiple states at the same time matches with the quantum principles of a q bit which is in multiple states at the same time.. is the match exact or just in theory? That’s a very sharp observation 👍 Let’s carefully unpack it: 1. NFA "multiple states at once" In a nondeterministic finite automaton (NFA), when it reads an input symbol, it may branch into several possible next states. Mathematically, this is modeled as the automaton being in a set of states simultaneously . But in implementation terms, it’s not "real simultaneity." It’s more like: Either you explore all branches in parallel (conceptually), or You use backtracking/parallelism to simulate it deterministically. So the "multiple states" is really a computational convenience —a bookkeeping method. 2. Qubit "multiple states at once" A quantum bit can be in a superposition : [ \alpha |0\rangle + \beta |1\rangle, \...

Lehmer's code compression analysis

 Question: I hope readers are aware of Shannon's information theory which says that information content associated with an event a with probability p(a) is -log(p(a)). In layman terms if you need to represent a number in the range of 0-7 then you require at least -log(1/8)=log(8) (where base is 2) ie 3 bits. Suppose there is an array of integers ranging from 0 to 255. Instead of storing the array as 8 bit numbers i will sort the array in ascending order first (keeping a backup of course). Instead of encoding every array element as an 8 bit integer i will output its position in the sorted array. Now the problem is to let the decoder or receiver know this sorted array. I will output the first(least) integer value as an 8 bit number, then the increment to be added to this number and soon. First all of the sorted array followed by the order of the elements i.e the position values. Ex: original array-> 231 , 3 , 45 , 0 , 23 , 32 , 78 sorted array-> 0,3,23,32,45,78,231 the encoded ...