powered by
Computes the next binary string in a Gray code sequence using Knuth's Algorithm G.
gray(ind)
A binary string.
The next binary string in the Gray code sequence.
# NOT RUN { n<-4 indi<-rep(0,n) allinds<-c() for(i in 1:(2^n)){ allinds<-rbind(allinds,indi) indi<-gray(indi) } allinds # }
Run the code above in your browser using DataLab