-4
$\begingroup$

For example, in real life, you're working with real time data that is constantly appended to. Computer science assumes a static problem, like traveling salesman. In reality you would start with a set of cities and add and remove them over time, so the solution at the individual step is trivial, and it's easier to store the result in memory than to run a fancy algorithm every time.

Likewise if you want to traverse a data structure in a certain way, isnt it easier to create a system of pointers and just store it in memory (x is the last branch etc) than having to find the last branch at runtime with an algorithm?

Is computer science actually excessively computational to the point it ignores easy in-memory or pointer solutions to most data structure problems?

$\endgroup$
1
  • $\begingroup$ The study of real-time systems processing real-time data is also a subdiscipline of computer science. See Timed Petri Nets... $\endgroup$ Oct 10, 2020 at 5:00

2 Answers 2

9
$\begingroup$

Your question takes a very narrow and untrue view of what computer science is. Computer science doesn't "assume a static problem" -- there is an entire subfield studying Online Algorithms, which take input problems piece-by-piece, as just one example.

Computer science is the system of methods for analyzing computing problems (i.e., making efficient use of computing time and computing memory). If you have (correctly) worked out a better way to solve a problem, then you are doing Computer Science. In general, it makes no such "static assumptions" or "ignores in-memory pointer solutions". You'll find that nearly any problem has been studied from nearly any angle, by someone in computer science.

When you describe "a system of pointers and how to store them in memory", what are you doing but describing an algorithm? An algorithm is a description of executable steps -- if you have devices a system of pointer-bookkeeping that solves the problem, you have devised an algorithm. If that algorithm doesn't find the "optimal" solution, it's still an algorithm that may be analyzeable by standard methods in Computer Science (e.g., "average"/worst-case runtime; or approximation bounds)

It's true that many problems faced in the "real world" are not addressable solely by the algorithms and data-structures taught in the first few years of a computer science education, and also that many real word problems do not require optimal solutions (not that computer science only studies optimal solutions -- it doesn't, optimizations and approximations are very intently studied).

However, the point of teaching the "standard" algorithms and data-structures isn't only to give a complete toolkit, but to provide a breadth of examples that introduce many different techniques:

  • Algorithms for solving NP-complete problems like the Traveling Salesman Problem can introduce the concept of heuristics (which may or may not be "complete") and approximations
  • Data-structures like doubling-arrays can introduce the concept of amortized analysis
  • Data-structures like balanced trees prove out the concept of worst case analysis, showing that naive implementations can lead to pathological runtimes, and showing that there are bounds to how much you can improve in general (e.g., you can do insertion & lookup better than $\Theta(n)$ and no better than $\Theta(\log(n))$)
$\endgroup$
3
  • $\begingroup$ Real life salesmen and delivery companies dont use computer science. And a data structure can almost always be stored in a way that is an 0(1) lookup. $\endgroup$
    – user127262
    Oct 10, 2020 at 5:14
  • 3
    $\begingroup$ On the contrary, logistics is full of NP-hard optimisation challenges. To pick one real-word example, consider the problem of placing containers on a ship. Stevedores charge by the hour, so you must minimise the time spent in dock at any specific location, so containers for a given destination should not be buried under other containers if you can avoid it. Not only will containers be unloaded at a given location, some will also be loaded. And you also have a complex mass distribution constraint so that the ship doesn't list (i.e. tilt) in bad weather. Now find the optimal solution. $\endgroup$
    – Pseudonym
    Oct 10, 2020 at 6:12
  • 1
    $\begingroup$ "And a data structure can almost always be stored in a way that is an 0(1) lookup." If you're willing or able to use more space, sure. Otherwise, this claim is provably not true. It has been proven, for example, that there is no representation for a finite permutation which a) uses succinct space ($(1 + o(1)) n \log n$ bits) and b) supports reverse lookup in constant time. $\endgroup$
    – Pseudonym
    Oct 10, 2020 at 6:17
2
$\begingroup$

Even though computer science can be understood as a science of problem solving, as a science, it is above all interested in framing (answerable) questions. Questions about problem solving methods, whose answers can then be applied to the "real world" (whatever that is), sometimes by scientists themselves, most of the time by people in other walks of life.

Although it's true that very often solutions to practical problems are not a direct application of scientific research, it is also true that many times the presence of scientific results is hidden in plain sight, as the answers they bring are converted in common knowledge.

Your question relies on notions that you take for granted $\unicode{x2013}$ they seem real $\unicode{x2013}$, but weren't always so approachable. They were once purposefully conceived by scientists, who were deeply aware of the complexity of the choices they were making, and their implications, so that you can now navigate these notions in oblivion, as if they have grown on trees.

That said, I don't think your question should be disqualified. I think it can be useful to others, in its naiveté.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.