Bit Strings: Recursive Definition

  • Thread starter sta|ker
  • Start date
  • Tags
    Definition
In summary, the set of bit strings with an equal number of 0's and 1's can be recursively defined as: starting with the basis of 0 followed by any number of 1's and ending with 0, and then recursively adding 0's on both sides of the string. The set can be represented as A = {010, 00100, 001100, ...}.
  • #1
sta|ker
12
0

Homework Statement


Give a recursive definition for the set
of bit strings [itex]\{ 0^{r} 1^{s} 0^{r} \| r, s \in N \}[/itex]. Note the number of 0’s must be equal, but the
number of 1’s may be different from the number of 0’s.

Homework Equations


N/A

The Attempt at a Solution


I believe this is:
Basis: [itex]\lambda \in A[/itex]
Recursive Step: If [itex]\omega \in A[/itex], then [itex]0 \omega 1 \omega 0 \in A[/itex]

I just want to verify if this is correct or not.

Thanks!
 
Physics news on Phys.org
  • #2
If [itex] \omega = 010 [/itex] then you just claimed that 001010100 is in A.
 
  • #3
Office_Shredder said:
If [itex] \omega = 010 [/itex] then you just claimed that 001010100 is in A.

Ohh, I think I see. [itex]w[/itex] represents the initial value, which would basically make everything I put wrong. What about the following:

Basis: [itex]0 1^{n} 0 \in A , n \in N[/itex]
Recursive Step: if [itex]w \in A[/itex], then [itex]0 w 0 \in A[/itex]

Because, this would give: [itex]A = \{ 010, 00100, 001100, ... \}[/itex]
 

FAQ: Bit Strings: Recursive Definition

What is a bit string?

A bit string is a sequence of binary digits or bits, typically represented as 0's and 1's. It is used to represent and store data in computer systems.

How is a bit string defined recursively?

A bit string is defined recursively as either an empty string or a string of bits followed by another bit string. This means that a bit string can be broken down into smaller parts, with the base case being an empty string and the recursive case being a string followed by another string.

What is the length of a bit string?

The length of a bit string is the number of bits it contains. This can vary depending on the specific bit string, but it is always a non-negative integer.

Can a bit string contain only 0's or 1's?

Yes, a bit string can contain only 0's or 1's. In fact, these are the only two possible values for each bit in a bit string.

How are bit strings used in computer science?

Bit strings are used in a variety of computer science applications, such as data storage, data compression, and cryptography. They are also commonly used in programming languages to represent and manipulate data, as well as in algorithms for tasks such as sorting and searching.

Similar threads

Back
Top