consider a link list l which can contain nodes representing the bits

GenerateBitStrings(int length)
{
  if (length == 0)
  {
    //print all values in link list l
  }
  Add 1 to l
  call GenerateBitString(length-1)
  Remove the 1 that was added.
  Add 0 to l
  call GenerateBitString(length-1)
  Remove the 0 that was added.
  return;
}

call this function GenerateBitString(length) passing n as length.

On Aug 12, 1:30 pm, Raj N <rajn...@gmail.com> wrote:
> Hi,
> Can someone gimme the code to generate all possible bit strings of
> length n recursively ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to