Uni Algodat Notes

Notes for the Algodat (algorithms and data structures) course at HdM Stuttgart

Felicitas Pojtinger

2022-02-01

1.1 Introduction

1.1.1 Contributing

These study materials are heavily based on professor Toenniessen’s “Algorithmen und Datenstrukturen” lecture at HdM Stuttgart.

Found an error or have a suggestion? Please open an issue on GitHub (github.com/pojntfx/uni-algodat-notes):

QR code to source repository

If you like the study materials, a GitHub star is always appreciated :)

1.1.2 License

AGPL-3.0 license badge

Uni Algodat Notes (c) 2021 Felicitas Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

1.2 Cheatsheet

I created a hand-written cheatsheet which contains the most important points; you can print it (use a printer with at least 2400 DPI) for use in the exam: Cheatsheet

1.3 Themen

1.4 Paradigm Conversion

I’m too stupid to write proper functional code, so most of the times I “convert” my imperative solutions to functional ones using the following schema I found on the web:

  1. Isolate the loop in its own function. Make sure that all captured variables (i.e., variables that are used in the loop, but not declared in the loop) are passed in as parameters.
  2. If the loop declares its own counter (e.g., in a for-loop), remove that declaration and make the loop counter another parameter.
  3. Replace the loop construct itself:
    1. Replace the loop condition check with an if statement (or if expression, if that’s what your language has).
    2. In the failure branch, return.
    3. Move the rest of the loop code into the success branch.
    4. At the end of the success branch, add a recursive call which passes the modified values of the loop counter and all captured variables; this is equivalent to the jump back to the top of the original loop.
  4. At the original site of the loop, put in a call to your new recursive function. This is where you’ll now provide the initial value of the loop counter.
  5. Perform whatever other optimizations seem obvious, as the code at this point will be functional, but probably ugly, probably inefficient, and probably unidiomatic.

1.5 Begriffe

1.6 Eigenschaften von Algorithmen

1.7 Zeitkomplexität

  1. Ausgangspunkt: Algorithmus A
  2. Finde ein Maß für die Problemgröße des Inputs
  3. Finde die Anzahl der signifikanten Schritte von A bei Problemgröße N.
  4. Bestimme das Wachstumsverhalten der Funktion für N→∞
  5. Vergleiche Funktion mit t(N) und finde richtiges Wachstumsverhalten.

1.7.1 Wichtige Wachstumsfunktionen

1.7.2 Sortieralgorithmen

1.8 ADTs

1.8.1 Übersicht

1.8.2 Stack

1.8.3 Queue

1.8.4 Binärbaum