Does Cs50 make mistake when it calls an input a problem to solve?

Viewed 33

So in week 0 of Cs50 course. They present computer science as problem solving.

Afterwards they show picture of input going into box that represent algorithm and coming out as output.

And they define each term separately,defining input as a problem to solve?

But that doesn't make sense. Isnt input information we get from the user not necessarily problem itself? Like i understand that we can change definitions a little bit but that changing a meaning completely?

Like it can just be a part of the solution/part of algorithm but can be part of it half way through for example. Like needing a information from the user to complete certain algorithm in a correct way and asking for that information in a from of the input.Then input isn't really a problem to solve but just necessary component of algorithm?

Input rarely represent problem to solve but its mostly part of algorithm that has a goal to be for example interactive?

I know im probably wrong because they are college course but then why is their definition correct exactly?

1 Answers

Your confusion is understandable and sound. I would say it's a bit of a philosophical question. It also depends on the level of abstraction we are discussing.

If you have a computer game, it's solving millions of problems every frame. When the user pressed a key or moves the mouse, that's an input for the program, something to update and base its calculations on. You could say it is information for knowing what problems to solve.

But on a more theoretical level, you can ask what an algorithm or a program is. We often say that an algorithm is a series of steps for how to solve a problem. There is an asbract computer model called the Turing Machine, and we can use it to solve many problems. A specific Turing Machine solves a specific problem. It gets some well-defined input and does its computations on that, to return an answer when it's done.

We often see this input as a specific problem. For instance, imagine the Turing Machine that takes an array of numbers and sorts them. If we give it the array [2,3,1], then we have a problem: "What is [2,3,1] in sorted order? The machine will sort it and return [1,2,3], as expected. When we give it a different array, it's a different problem.

If you prefer, you can see these as problem instances. But you can also just see them as separate problems in the same class of problems.

In conclusion, I would not drop your intuitive understanding of problem, algorithm and input: they are probably correct. But as you study theoretical computer science further, you will encounter this way of thinking a lot. In the end, it's only a matter of points of view.

Related