## Why can’t programs be proven?

Why can’t a computer program be proven just as a mathematical statement can? A mathematical proof is built up on other proofs, which are built up from yet more proofs and on down to axioms – those truths truths we hold as self evident. Computer programs don’t seem to have such a structure. If you … Read more

## Why can Conway’s Game of Life be classified as a universal machine?

I was recently reading about artificial life and came across the statement, “Conway’s Game of Life demonstrates enough complexity to be classified as a universal machine.” I only had a rough understanding of what a universal machine is, and Wikipedia only brought me as close to understanding as Wikipedia ever does. I wonder if anyone … Read more

## Is the time complexity of the empty algorithm O(0)?

So given the following program: Is the time complexity of this program O(0)? In other words, is 0 O(0)? I thought answering this in a separate question would shed some light on this question. EDIT: Lots of good answers here! We all agree that 0 is O(1). The question is, is 0 O(0) as well? … Read more

## When have you come upon the halting problem in the field? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 years ago. Improve this question When have you ever personally come upon the halting problem in the field? This can be … Read more

## How are hash functions like MD5 unique?

I’m aware that MD5 has had some collisions but this is more of a high-level question about hashing functions. If MD5 hashes any arbitrary string into a 32-digit hex value, then according to the Pigeonhole Principle surely this can not be unique, as there are more unique arbitrary strings than there are unique 32-digit hex … Read more

## Coupling and cohesion

I’m trying to boil down the concepts of coupling and cohesion to a concise definition. Can someone give me a short and understandable explanation (shorter than the definitions on Wikipedia here and here)? How do they interact? Thanks. Anybody have a good, short example? Answer Coupling Loose: You and the guy at the convenience store. … Read more

## How to program a fractal?

I do not have any experience with programming fractals. Of course I’ve seen the famous Mandelbrot images and such. Can you provide me with simple algorithms for fractals. Programming language doesn’t matter really, but I’m most familiar with actionscript, C#, Java. I know that if I google fractals, I get a lot of (complicated) information … Read more

## Is the C99 preprocessor Turing complete?

After discovering the Boost preprocessor’s capabilities I found myself wondering: Is the C99 preprocessor Turing complete? If not, what does it lack to not qualify? Answer Well macros don’t directly expand recursively, but there are ways we can work around this. The easiest way of doing recursion in the preprocessor is to use a deferred … Read more

## “const correctness” in C#

The point of const-correctness is to be able to provide a view of an instance that can’t be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. So without copying the … Read more

## The recognizing power of “modern” regexes

What class of languages do real modern regexes actually recognise? Whenever there is an unbounded length capturing group with a back-reference (e.g. (.*)_\1) a regex is now matching a non-regular language. But this, on its own, isn’t enough to match something like S ::= ‘(‘ S ‘)’ | ε — the context-free language of matching … Read more