# AlgorithmsandDataStructures

Spring 2021
##### site -->

# complexity theory & related topics

This is a huge topic - one of the major subfields of theoretical computer science : Formal Langauges and the Theory of Computation

What is a "formal language"?

• a math definition of what an "algorithm" means
• and what sort of abstract can do different sorts of problems
• and how fast ; its O()

The big ideas are :

Formal expression of the notion of "algorithm"

• each "problem" is reduced to a "set of strings" questions, defining a "formal language"
• so addition for example is reduced to all strings like "1+2=3"
• ... and a computer program that can "do" addition is one that can say "yes" or "no" to whether or not such a string represents a true arithmetic addition expression.

Formal notion of "machine" (i.e. computer)

• mathy description of what it can do ... to a string of symbols, ending with "yes" or "no"
• simple so that the proofs about it can be manageable

For some categories there is 1-to-1 relationship between classes of languages and machines (the "template" link above)

• and how hard they are to describe
• and what sorts of abstract machines can solve them
• and how fast, i.e. what O() those machines take

A few "machines" :

An open question : P vs NP

• P : polynomial time for a turing machine
• NP : nondeterministic polynomial (i.e. polynomial for parallel turing machine, also turns out to be "quickly verifiable")
• Broadly speaking, problems in P are "easy" (i.e. computers can solve big N versions), problems in NP are "hard" (i.e. big N can't be done fast enough).
• NP-complete : it turns out that many problems that seem to be in NP can be turned into each other, so if one can be solved fast, then all of those can.

But note that there are problems provably "harder" than NP ... and even some that no turing machine can solve in bounded finite time

## aside: regular expressions

Note that in most programming languages, their library for "regular expressions" includes some syntax that is more powerful than the formal mathy definition of "regular expression". The "grouping" constructs, in particular, are not part of the formal mathy notion of a regular expression, but are often used in practical programming code.

This regex_ab.py is an example of the difference. And here's the finite state machine for the first pattern.

## philosophy of mind

One related deep question is how people fit into all this. In other words is (intelligence, consciousness, sentience) computable? What do those things even mean.

What do you think?

## information theory

And another related topic is the concept of "information", which has to do with patterns in data, randomness, and compressibility. Yet another course sized topic.