Is checking if the length of a C program that can generate a string is less than a given number decidable?

I was given this question:

Komplexity(S) is the length of the smallest C program that generates the string S as an output. Is the question “Komplexity(S) < K” decidable?

With respect to decidability, I only know about the Halting Problem and just learned about Rice’s Theorem while searching online (though I don’t think it can be applied here?). I couldn’t reduce the problem to any undecidable problem I know about. Thanks in advance for any help

Dynamic length of union of segments (1d Klee’s measure problem)

Finding the length of union of segments (1-dimensional Klee’s measure problem) is a well-known algorithmic problem. Given a set of $ n$ intervals on the real line, the task is to find the length of their union. There is a simple $ O(n \log n)$ solution involving sorting endpoints of all intervals and then iterating over them while keeping track of some counters.

Now let’s look at a dynamic variant of this problem: we are receiving $ n$ segments one after another and the task is to find the length of the current union of segments after each new segment arrives. It seems like a natural generalization, however, I cannot find much information about this version of the problem. I wonder if it is still possible to solve this problem in $ O(n \log n)$ time in an offline setting, i.e. when we are given all segments beforehand and can preprocess them in some way before giving an answer for each segment.

I feel like a modification of a segment tree might be useful here. In every node we need to keep track of both the total sum of lengths of segments (or their parts) corresponding to this node and the length of their union. However, I cannot figure out how to implement this modification without performance of one update degrading to linear time in some cases. Maybe using a segment tree is not the right approach and a better way exists.

Should user input be validated/checked for it’s length in PHP (server side) as a security measure?

important to note that this user input is something that after validation & sanitation – will be inserted into a database, and later on be shown to other users on the same web site. (example: a forum) I’m referring to both a case when I know in advanced what’s the length I should expect from the user and a case in which I don’t but know vaguely that’s not more than 100 length. I’m trying to figure out if there is any security advantages for checking user input length in PHP. taking into account I’m already validation & sanitation user input based on the type of content I’m expecting using regex. I know this differs from language to language to I want to refer to PHP this time, but any referring to other language like Java, .NET, python etc. would be fine.

Excerpt length decision

What should I take into account when limiting the text visible on a listing? I’m using a list layout with images on the left side, a title, a meta line and the excerpt, And I’ve wondering if there are any best practices like:

  • limiting the excerpt to full sentences only without breaking the sentences
  • limiting the text to fill n lines
  • limiting to words and add three dots and read more link afterwards
  • limiting the words and using justified text alignment …

What do you think?

How to determine minimum word length of regular language

Given a regular language $ L$ and a regular expression $ r$ with $ L=L(r)$ . Is it possible to determine the minimum length of words of $ L(r)$ by the structure of $ r$ ?

A straightforward example:

Let’s say we have a regular expression $ r=aac^*aa$ , then $ L(R) = \{aaaa, aacaa, aaccaa, \dots, aac^naa\}$ . To determine the minimal length I would erase everything that is postfixed with $ *$ , leaving $ r’=aaaa$ . Now I would count the concatenations and add 1, which would yield in this example, not unsurprisingly, a minimum length of 4.

Is there a general approach to do this for more complex expressions?

What should be minimum password length for security today? [duplicate]

This question already has an answer here:

  • What's the best length for randomly generated passwords? (Security vs. compatibility) 4 answers
  • It's well into 2017 – what's the latest best practise password policy 2 answers

What should be mimimum user password lenght for security today if we use uppercase, lowercase, number and special character?

Fastest algorithm to find all the possible paths of length $n$ from a give node in a directed graph?

I am trying to find the fastest algorithm to find all the possible paths of length $ N$ from a given node in a directed graph.

My solution is to do a modification of breadth first search from the given node for $ N$ iteration. Its time complexity is around $ \theta(V+E)$ . But the problem is $ |V|$ & $ |E|$ becomes exponential because as long as there is an edge, the same node can be visited again.

Can there be a solution of this problem with polynomial time complexity? It seems this problem has optimal substructure solution. Is there any solution using dynamic approach?

Are number of states in a NFA same as Pumping length?

So i was reading a post on Minimum pumping length of regular language where Yuval Filmus has proved that a pumping lemma might have lesser number of states than a minimal DFA. But What about NFA’s? Are NFA’s able to give us minimum pumping length?

For example say we have a language L= $ (10)^∗$ , though for this minimal DFA will have $ 3$ states but NFA will have only $ 2$ states, which in fact is the pumping length of the language. So are NFA’s able to give us exact pumping length of a language?