How can I construct a regular expression for the language over $ \{0,1\}$ which is the complement of the language represented by the regular expression $ 10(0+1)^*$ ?

# Tag: Strings

## Regular expressions for set of all strings on alphabet $\{a, b\}$

I came across following regular expressions which equals $ (a+b)^*$ (set of all strings on alphabet $ \{a, b\}$ ):

- $ (a^*+bb^*)^*$
- $ (a^*b+b^*a)^*$
- $ (a^*bb^*+b^*ab^*)^*(a^*b+b^*a)^*b^*a^*$

I want to generalise different ways in which we can append to original regular expression $ (a+b)^*$ , to not to change its meaning and still get set of all strings on alphabet $ \{a, b\}$ . I think we can do this in two ways :

**P1:**We can concatenate anything to $ a$ and $ b$ inside brackets of $ (a+b)^*$-
**P2:**We can concatenate $ (a+b)^*$ with any regular expression which has star at most outer level ($ (…)^*$ ) -
**P3:**I know $ (a+b)^* = (a^*+b)^* = (a+b^*)^*= (a^*+b^*)^*$ . So I guess P1 and P2 also applies to them.

Am I correct with P’s?

**Q.** Also I know $ (a+b)^*=(a^*b^*)^*=b^*(a^*b)^*=(ab^*)^*a^*$ . Can we append some pattern of regular expressions to these also to not to change their original meaning?

## Evaluating predicate on binary strings

Consider two *unknown* binary strings $ $ X = x_{1} x_{2} \dots x_{n^{2}}, \quad Y = y_{1} y_{2} \dots y_{n^{2}}, \quad x_{i}, y_{i} \in \{0, 1\} .$ $ We may request a string $ Z = z_{1} z_{2} \dots z_{n^{2}}$ , where $ z_{i} = x_{i}$ or $ z_{i} = y_{i}$ , no more than $ n + 1$ times. So, for every request we set required $ z_{i}$ (that is, $ x_{i}$ or $ y_{i}$ ) for every $ i$ .

Moreover, we have $ n$ bits of unwritable memory, namely, every bit of that memory is set once and then does not change. This memory is avaliable all the time, but requested $ Z$ strings drop out before the next request, so, we don’t have complete list of all requested $ Z$ strings.

The problem is to check if $ X = Y$ with given $ n$ bits and $ n + 1$ times for $ Z$ string request.

There is an extra question: is it possible to use $ \mathcal{O}(\log^{2}(n))$ bits of memory and $ \mathcal{O}(\log(r))$ requests.

I don’t really understand area of CS that is closely related to the problem, could anyone give a hint?

## How many “compressible” strings are there?

Let’s say that a string of length $ N$ is “compressible” iff its Kolmogorov complexity is less than $ N$ . To keep it simple, we can assume binary strings for this.

It is easy to see that almost all binary strings of length $ N$ are incompressible by using the pigeonhole principle.

So my question is, how many strings of length $ N$ *are* compressible?

In particular, let’s assume that $ K(S)$ is the Kolmogorov complexity of binary string $ S$ , which is of length $ N$ . Then I have the following three questions:

- Of the $ 2^N$ binary strings $ S$ of length $ N$ , how many have $ K(S) < N$ ?
- Of the $ 2^N$ binary strings $ S$ of length $ N$ , how many have $ K(S) \leq N/2$ ?
- Of the $ 2^N$ binary strings $ S$ of length $ N$ , how many have $ K(S) \leq \log N$ ?

All of the above are for sufficiently large $ N$ .

## Regular Expressions to accept strings where every two successive 0s are followed by a 1

How do I define a Regular Expression for the language L = {w|every two successive 0s are followed by a 1} ?

I don’t have any idea on how to even approach this problem, primarily because it says “**every two 0s**“.

## Build a DFA that accepts strings over {0,1,2} that are divided by 3 and doesn’t include the substring 012

Ive tried to draw it but im not finding the right way. Ive also read it “How to prove a language is regular?” and here – https://math.stackexchange.com/questions/1556655/build-a-dfa-that-accepts-strings-over-0-1-2-that-are-divided-by-3-and-do , but still in the same situation. hope someone can help or give a lead.

Thats what ive got so far:

## Why is the lower bound for sorting strings Ω(d + nlogn)?

I’m taking an Advanced Algorithms course. I’m currently studying efficient algorithms for sorting strings. In this chapter, it is provided a lower bound for the time complexity of Ω(d + nlogn), where d is the sum of the distinguishing prefixes of all the strings in our set S and n is the cardinality of the strings set S. The book says this is the minimum number of comparisons any algorithm must take, and I cannot figure out why. Can you help me? Thank you.

## Finding the number of distinct strings in regular expression

Given the regular expression $ (1 + \varepsilon + 0 )(1 + \varepsilon + 0 )(1 + \varepsilon + 0 )(1 + \varepsilon + 0 )$ , how many distinct strings are in the language? How do you determine this from looking at the regular expression? Do I have to generate a table of all possible combinations or is there a more straightforward way?

## Decrypting strings C and D without knowing the keys

I have a question:

Let’s assume I encrypt string A with string B(key) (the result is string C) and then I encrypt string B with string A(key) (the result is string D). Let’s say using AES algorithm.

If an attacker knows that AES is the algorithm I used and also has C and D, can they figure out strings A and B?

## Regular expression for set of strings with no two consecutive 1’s?

I’m having trouble figuring out a regular expression over the alphabet {0,1} that contains all strings with no TWO consecutive 1’s.

I’m also wondering if there is a pattern that could be extended to three consecutive 1s. etc…

Would something like this be correct?

(0 U (10))* U (0 U (10))* 1