Theoretical Computer Science & Machine Learning – Exam Notes
Algorithms and Data Structures
- IPO-Model: Input → Process → Output; data structures supply input format, algorithms implement process.
- Digital vs. Analog computers: discrete vs. continuous encoding; programmability unique to digital.
Algorithms
- Formal definition (Webster 2021): finite, unambiguous, step-by-step procedure mapping finite inputs to outputs in finite time.
- Correctness (specification / verification) and efficiency (time, space).
- Euclidean GCD shown in iterative and recursive pseudocode.
- Key questions: Why? (specification) – Does it work? (verification) – How efficient? (analysis).
Data Structures
- Arrays (1-D & 2-D), Linked Lists, Queues (FIFO), Stacks (LIFO), Heaps (min-/max-binary tree).
- Choose structure by access pattern & resource constraints.
Graphs & Trees
- Directed graph with out-degree , in-degree .
- Undirected .
- Representations (space):
• Incidence
• Adjacency matrix
• Adjacency list (directed) / (undirected). - Trees: directed acyclic graph with single root (or unique undirected path). Binary tree .
- Use cases: Euler’s Königsberg bridges, network attack graphs, BloodHound AD analysis.
Sorting & Searching
- Selection, Insertion, Bubble ; Quick Sort avg .
- Searching: Linear , Binary (needs sorted), String matching – Naïve, KMP , Boyer-Moore.
Algorithm Analysis
- Primitive operations → cost function ; asymptotic classes: \log n< n < n\log n< n^2< b^n < n!
- Big-O upper bound, lower, tight.
- Example loops: constants ignored; nested loops multiply.
Formal Languages & Automata
- Grammar where are productions .
- Chomsky hierarchy
- Type-3 Regular (right-linear) – DFA/NFA.
- Type-2 Context-free – PDA.
- Type-1 Context-sensitive – LBA.
- Type-0 Recursively enumerable – Turing machine.
- Regular language example ; conversion between grammar↔DFA; Rabin-Scott: NFA ≡ DFA.
- Context-free: , CNF conversion, CYK parsing, prefix function for KMP.
- Context-sensitive: , productions keep length, Turing-level power.
- Pushdown automaton with stack symbol .
Computability, Decidability & Complexity
- Halting problem undecidable (Turing 1936).
- Church-Turing Thesis: every effectively calculable function computable by Turing machine.
- Decision-problem status table (Regular, CFG, CSG, Type-0): Word ✓✓✓✗, Emptiness ✓✓✗✗, Finiteness ✓✓✗✗, Equivalence ✓✗✗✗.
- Complexity classes (relations):
; NP-hard, NP-complete = NP ∩ NP-hard. - Quantum
- Qubit state ; Bloch sphere.
- Algorithms: Shor (factorization) on QC; Grover search .
- Complexity class BQP; inclusion with P, NP unknown.
Logic
Propositional Logic
- Connectives tables; tautology vs. contradiction vs. contingency.
- Equivalences: De Morgan, implication elimination .
- Normal forms: CNF = AND of OR-clauses; DNF = OR of ANDs.
- Inference rules (MP, MT, HS, DS, CD).
Predicate Logic
- Predicates, variables, quantifiers ; translating natural language.
- Prenex & Skolem normal forms for resolution.
Proof Calculi
- Resolution: convert to clausal CNF, derive empty clause ◻; complete for unsat.
- Tableau: alpha/beta expansion; closed tableau ⇒ unsat, open ⇒ model.
Program Analysis & Verification
- Static vs. Dynamic analysis; symbolic execution; data-flow; model checking.
- Hoare triples , axiomatic semantics; inference rules for assignment, sequence, if, while.
- Semantics descriptions
- Algebraic: equational reasoning.
- Operational: small-/big-step transitions.
- Denotational: mapping syntax to mathematical functions.
- Abstract Interpretation
- Abstract domain (e.g., intervals); sound over-approximation.
- Framework: abstraction function, Galois connection, widening.
- Example: interval analysis of simple program to bound variable ranges.
Artificial Intelligence & Machine Learning
Paradigms
- Supervised (labeled) vs. Unsupervised (unlabeled clustering).
- Regression: predict continuous .
- Classification: discrete labels; logistic function
Linear & Multiple Regression
- Hypothesis , cost .
- Gradient descent .
Logistic Regression / Softmax
- Binary cost .
- One-vs-all for classes; choose
Neural Networks
- Neuron output with bias .
- Layers: input → hidden(s) → output; weight matrices .
- Forward propagation yields ; back-prop + gradient descent minimize
- Applications: malware e-mail multi-class detection, captcha OCR, intrusion detection.