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:

  1. Of the $ 2^N$ binary strings $ S$ of length $ N$ , how many have $ K(S) < N$ ?
  2. Of the $ 2^N$ binary strings $ S$ of length $ N$ , how many have $ K(S) \leq N/2$ ?
  3. 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$ .

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 – , but still in the same situation. hope someone can help or give a lead.

Thats what ive got so far: DFA that accepts all strings

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?