Question

Let Program P be :"Generate, in lexicographic order, all sequences with k ones and n bit length; Of these sequences, print the ith sequence."

Apparently the length of this program is $\log(n) + \log(\binom{n}{k}) + c$ where $c$ is a constant. Where $i$ can be represented in $\log(n)$ bits and k in $\log(\binom{n}{k})$ bits. Why does the length of the program not take into account that we will be generating all of these sequences in lexicographic order, does the length of the sequences and the number of sequences not depend on $n$. Don't you have to hold those in an array? Does that not take space?

Thank you.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top