Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I like how "Introduction to Algorithms" by Cormen et al. conveys knowledge. One reason is that everything has to do with programming problems and the book is not implemented in any particular programming language. This language independency provides focus on the ideas in general.

So my question is, as it says in the title. Is every solveable programming problem solveable by thinking in this algorithmic fashion. No matter which language, field, etc ? If yes, give arguments, else, give arguments!

I have not implemeted many complex programs with GUI, AI, Graphics, etc ... But are these types of problems also a matter of thinking out good algorithms?

share|improve this question

closed as too broad by GlenH7, MichaelT, Kilian Foth, Bart van Ingen Schenau, Michael Kohne Dec 4 at 19:27

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

The most common problem for a programmer, imho, is: "oh, THAT was what you meant? now i understand. it's not what i implemented though, sorry". Is that a programming Problem? –  keppla Aug 22 '12 at 13:19
This question is very similar. –  back2dos Aug 22 '12 at 13:51
You need to do a report with the client, describe their requirements and based on that you have to design, test, implement, refactor, optimize and maintain the software. You need environments to test, develop, deploy, run and measure the software. In this system an individual algorithm is just an implementation detail. –  inf3rno Dec 3 at 14:41
@Keppla (plus one) ope, it's a requirements problem, the root cause of all software woes –  Mawg Dec 3 at 16:49

6 Answers 6

It depends on how you define "Programming Problem".

In real-world projects, the answer is definitely a clear NO. Most of the problems are not even technical problems, but communication problems, requirements that are unclear, etc.

Then you have whole subjects of problem-classes that require next to no algorithms. For example, GUIs are often straightforward to "program", but the actual problem involved is to have a good design (from a useability point of view, not just the graphical appearance).

There are some fields, where the problems tend to be much more algorithmic by the nature of that field though. For example, AI is a prime subject, where algorithms are at the core. Graphics can be algorithm intensive, but it depends on what exactly is meant with "Graphics Programming".

In general, if the problem you are solving programmatically is suitable for a mathematical representation, then you are entering the algorithmic area. Of course, this is just a rough indicator, as you may create mathematical models for pretty much everything. But for most things you wouldn't normally consider doing so.

Final example: If the problem is to create a GUI that allows entering data for business objects, you wouldn't think about mathematical formulations much. If, however, the problem is to create a GUI that is dynamically changing and relocates elements based on some importance value, you are much more likely to end up with a mathematical model and an algorithmic implementation.

share|improve this answer
Apparently, it also depends on how you define "Algorithm". I would say that very few problems require novel algorithms, but that since a computer program has only two parts--algorithms and data structures--all problems require some algorithms, even if those algorithms are trivial. An algorithm isn't a mathematical model, it's a sequence of instructions. –  philosodad Aug 22 '12 at 17:59
That is true in its strictest sense, but I, for one, do not accept i++ as our new overlord.. erm.. algorithm. –  Frank Aug 22 '12 at 18:36
But what if we didn't know about addition. Then the introduction of addition would a great innovation in our studies of algorithms! And so on until we encounter more and more complex algorithms. –  CMCDragonkai Jun 17 at 8:13

What do you mean by programming problem?

According to Wikipedia:

Computer programming (often shortened to programming or coding) is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs.

which means that programming in general is inherently larger than translating algorithms through code.

To give you an example, a programming problem I have right now is that I have to deal with a legacy spaghetti source code by adding unit tests, then refactoring it. It also involves adding comments in the right places, normalize the capitalization of names, etc. It has nothing or few to do with algorithms.

In the same way, many developer's tasks are unrelated to algorithms. Example: internationalization. In the very same way, lots of applications (CRUD, for example) don't use algorithms too much in their source code (not talking about the underlying code of the framework).

Now, if you're assuming that in "programming problem", "programming" is the synonymous of translation of algorithms through code, then yes, logically any problem would be an algorithm problem: A × n = B × n if A = B.

share|improve this answer
There's a difference between a task and a problem. Your problem is not to add unit tests or maintain legacy code, it's the solution to the problem which resides within the code base, not the program behaviour itself which the code represents by algorithms. –  zxcdw Aug 22 '12 at 12:30
Your task, as described, does not alter the behaviour of the program. Presumably it's preparatory work for some other changes, which might or might not involve algorithms. I don't think anyone anywhere is paid just to refactor working code all day long. –  MarkJ Aug 22 '12 at 13:10

I think the answer is emphatically no. Algorithms are just building blocks in a much larger skill set.

I got my degree in C.S., specializing in A.I.

There the fundamental problem, at least as I saw it, was to find good representations for information. These representations should try to be good matches for the knowledge structures that are in people's heads, and should facilitate the kinds of manipulations and alterations that are done on them.

In terms of day-to-day programming, this means the basic problem is to identify the right domain-specific-language (DSL) for the situation at hand. There are many ways to create DSLs. Ordinary programming, where classes, variables, and methods are defined is in fact creating a DSL because it allows you to say things (map your mental structures to code) that you could not say without them.

Algorithms are important too, but they are only part of the story.

share|improve this answer

I suppose you could say that all computer programs are algorithms, because you are prescribing a sequence of instructions to achieve a desired result. However, some of the most difficult problems aren't in communicating a program to a computer, they are in communicating a program to humans who will be testing and modifying the software.

In other words, computers don't care if your code is completely incomprehensible to humans. They will run it just fine either way. The challenge is in making code clear enough that any bugs will stand out like a sore thumb.

Interestingly, the technical things I learned in college about algorithms have long been eclipsed by what I've learned on my own since then. At this point if I wanted to get a 3rd college degree to help me in my job, it would be in English composition.

share|improve this answer
+1 for mentioning communication among humans. –  Stuart Marks Aug 22 '12 at 16:32

I would think that yes, all programming problems are solvable by thinking in an algorithmic fashion. After all an algorithm is just a set of instructions that tells the computer what to do.

Taking some of the examples from above

For example, GUIs are often straightforward to "program", but the actual problem involved is to have a good design (from a useability point of view, not just the graphical appearance).

In terms of the programming and even design that will know patterns/rules that lead to effective GUI designs that are user friendly and efficient. These rules be reduced to an algorithm that if followed should help produce a user friendly GUI. In fact the actual steps of placing the controls on the GUI can also be reduced to an algorithm

To give you an example, a programming problem I have right now is that I have to deal with a legacy spaghetti source code by adding unit tests, then refactoring it. It also involves adding comments in the right places, normalize the capitalization of names, etc. It has nothing or few to do with algorithms.

But the manner in which you approach adding unit tests can be described by an algorithm such as

  1. Identify new Unit Test
  2. Write Unit Test
  3. Apply Capitalisation Normalisation Algorithm
  4. Apply Comments algorithm

Example: internationalization This a perfect example of an algorithm solution. As its simplest you are looking up a known word in a dictionary and replacing with the different language form. (Of course real life involves sentences and context and the algorithm may involve steps to verify with native speakers but the basics hold true)

The issue with most of the Yes answers is that people are thinking of algorithms in terms of QuickSort, Bubble sort instead of a set of instructions that reduces a verbose vague description of a problem to a set of clearly defined logic/rules.

share|improve this answer

Most programming problems are actually system administration problems.

That's kind of a flippant answer, but I've found this is true more often than one might expect. I don't know how many times I've encountered failures because DNS was misconfigured on the test machine, a stale process is still running that's hogging CPU/memory/ports, the program is running with the wrong user ID and thus has the wrong permissions, the disk was partitioned incorrectly and so space ran out, the wrong version of the configuration file was installed, etc.

Getting the algorithms right is usually only a small part of the problem. The rest of the problem is putting the program to work solving real problems in the real world.

share|improve this answer
"Getting the algorithms right is usually only a small part of the problem" Problems at kaggle.com DO NOT[TM] fit that description. –  Gandalf Aug 22 '12 at 18:47
I agree, I just put them in the "plumbing" category. Working with other programmer's services, API and sometimes frameworks is just getting things connected as someone else thought they should work. –  JeffO Jun 3 at 18:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.