Skip to main content
119 votes
Accepted

How can lossless compression ever exist?

There can be no algorithm that losslessly compresses all inputs. But there are many algorithms that losslessly compress many inputs. And it turns out that most of the strings we like to operate on ...
Kilian Foth's user avatar
35 votes

How can lossless compression ever exist?

Compression works by making more likely patterns shorter at the cost of less likely patterns Suppose we have a data format which is a string of 4 possible values, we could represent it with 2 bits ...
mousetail's user avatar
  • 458
19 votes

How can lossless compression ever exist?

I recommend learning about Shannon entropy, but the simple answer is: lossless compression can't compress all inputs, but it can compress some inputs, and in practice that is enough. To demonstrate I'...
Jasmijn's user avatar
  • 1,914
18 votes

What is the logic in the order of operator precedence?

The designers of the Fortress Programming Language did extensive reviews of scientific literature to see how operators are used and what relative precedence they have. Based on those observations, ...
Jörg W Mittag's user avatar
17 votes
Accepted

What is an immutable object anyway?

I think the core issue here is that the term "immutability" is often not a uniquely and strictly defined term in the mathematical sense. Different people can have different kind of degrees ...
Doc Brown's user avatar
  • 220k
16 votes
Accepted

What was COBOL's syntax first described in?

Here is a link to the COBOL 60 spec : Initial Specifications for a COmmon Business Orientated Language (1960) BNF was first used the same year to describe ALGOL, here is a chapter ALGOL 60 - Chapter 6,...
Ewan's user avatar
  • 84.4k
12 votes

How can lossless compression ever exist?

For example, if you had a file with 16 bit audio, you can obviously represent it with 16 bit per sample. However, a simple lossless compressor will have an algorithm that predicts the next sample, and ...
gnasher729's user avatar
  • 49.4k
10 votes

What is the logic in the order of operator precedence?

There isn't some grand logical scheme, especially in C and the derivatives that kept its order. It's basically a combination of "this feels right" and historical accident. Obviously, you want to keep ...
Sebastian Redl's user avatar
8 votes

What is an immutable object anyway?

I've always thought of immutability in terms of the assignment operator: =. If all instance variables are marked final (or readonly, or const — whichever word the language uses) then they can only be ...
Greg Burghardt's user avatar
7 votes

How can lossless compression ever exist?

If our data was sequences of random values, and longer sequences were less likely than shorter ones, then lossless compression would on-average be worse than useless. But our data is far from random ...
Peter Green's user avatar
  • 2,326
6 votes

Always better to wait?

On terminology, I think you're looking for the "early adopter penalty" or the "penalty of taking the lead". It's a concept that has been recognised for at least 100 years. As to whether your ...
Steve's user avatar
  • 12.6k
5 votes
Accepted

Does only the concept of mathematical functions justify why methods need only to return one value

The reason functions only return one value is a technical one. It has to do with how the stack works in processors (and in assembler languages). First, a (tiny) lesson in how processors work. The ...
Becuzz's user avatar
  • 4,865
5 votes
Accepted

Why do programming languages have both double and float?

Doubles take twice more space. On some devices and for some applications this makes a difference. Think of 3D graphics: lots of numbers and no need for super-accurate results. Also, financial ...
Marco's user avatar
  • 337
5 votes

What's the difference between a pure function that expects a complex object of a particular type and object oriented programming?

A pure function is a function that: for the same arguments received it always returns the same result; running the function has no side effects. So these are properties of the function. It doesn't ...
Bogdan's user avatar
  • 3,660
5 votes
Accepted

Is a 'base' file always necessary when doing a merge?

Without a base file (a common ancestor of the files you want to merge) an automated algorithm can only tell that there is a difference between A and B, but it cannot tell if that is because A added ...
Bart van Ingen Schenau's user avatar
4 votes

Always better to wait?

The principle you are referring to is to postpone architectural decisions for as long as possible. Not so much because there will be better options later but because you will be able to make a more ...
Martin Maat's user avatar
  • 18.6k
4 votes

Testing and Debugging Techniques vs. Rice's Theorem

The difference between a bug and a feature is the same difference between a plant and a weed. It's either wanted or it's not. The work that goes into proving code correctness and testing isn't ...
candied_orange's user avatar
4 votes

Are there any theories about computing speed propotional to object amount?

Have a look at Big-O Notation. The core of an answer is already part of your question: "... the movements of each moving objects driven by regular algorithm ...". So, if you have N objects, then the ...
Ralf Kleberhoff's user avatar
4 votes

Academic question about table design

The question is comprised of several related (but ultimately separate) questions. using it in the URL should be okay (is this considered "exposing"?) "Exposing" is defined as "letting the outside ...
Flater's user avatar
  • 59.5k
4 votes
Accepted

How far can one debug a low-level API in closed-source environments?

Nothing's perfect and bugs can appear at the implementation phase. When this occurs, it is just impossible to backtrack those errors, as the source code is hidden. How far can we debug stuff in such ...
Doc Brown's user avatar
  • 220k
4 votes

How can lossless compression ever exist?

Other answers are right: not all data can be compressed. I'm not aiming to replace the accepted answer, but to provide some other descriptive text that might also be useful. I'd like to expand on the ...
TOOGAM's user avatar
  • 149
4 votes

What is an immutable object anyway?

The most popular answer is that it is an object which state does not change after creation. Yes, it means the objects state doesn't change after it is initialized. But that doesn't guarantee its ...
candied_orange's user avatar
4 votes
Accepted

Why is the 8-bit exponent of the IEEE 754 32-bit float not byte-aligned?

... it feels like it'd still be simpler for early circuitry to have byte-aligned fields is just an argument from personal disbelief. If you're taping out paths for 32 bits into the arithmetic units, ...
Useless's user avatar
  • 12.9k
3 votes
Accepted

How does the classic proof for the halting problem work?

Your problems are that you've added an input to H', when H' shouldn't have and doesn't need any inputs and you missed the point that H' specifically passes itself to H, not just any arbitrary function....
8bittree's user avatar
  • 5,676
3 votes
Accepted

Academic question about table design

I see two independent questions: 1) Is it OK to expose an auto-incremented key in URL's 2) Should primary key columns be named ID or <TableName>_ID I don't think these two questions are ...
JacquesB's user avatar
  • 62.3k
3 votes

Are there any formalized/mathematical theories of software testing?

There are some mathematical equations used, but it depends on the type of software testing that you're using. For instance, the Critical Fault Assumption assumes that failures are hardly the product ...
Charles Lucas Shabazz's user avatar
3 votes

Does only the concept of mathematical functions justify why methods need only to return one value

You are confused about the mathematical concept of functions only returning one value. This doesn't mean that an input can't return a very large aggregate output. It means that for the same input, ...
Karl Bielefeldt's user avatar
3 votes

Always better to wait?

If you need to build software, but you don't need it right now, it's always better to wait because the technology will be better in the future. If this were true we would never move forward. Rather ...
candied_orange's user avatar
3 votes

What could cause a bug to be "Person-Dependent"?

If it's not difference in hardware, software, or execution of the steps then obviously something non-deterministic is happening and Murphy is having a bit of fun at your expense. I once spent an ...
candied_orange's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible