Initial commit

This commit is contained in:
Never Gude 2026-04-30 16:08:36 +02:00
commit a1ddfdb7c0
14 changed files with 599 additions and 0 deletions

331
.gitignore vendored Normal file
View file

@ -0,0 +1,331 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bbl-SAVE-ERROR
*.bcf
*.bcf-SAVE-ERROR
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
*.rubbercache
rubber.cache
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# attachfile2
*.atfi
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
*.loc
# comment
*.cut
# context
*.tuc
*.tui
*.tuo
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glg-abr
*.glo
*.glo-abr
*.gls
*.gls-abr
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hypdoc
*.hd
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# latexindent will create succesive backup files by default
#*.bak*
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.data.minted
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# spelling
*.spell.bad
*.spell.txt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# latexindent.pl
*.bak[0-9]*
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,28 @@
# Gefordert: kommentiertes WHILE-Programm
# Sie können weitere Hilfsfunktionen verwenden!
# Namen:
#
#
#
########## HAUPTFUNKTIONEN ########## (Namen und Signatur nicht ändern!)
# Wir nutzen Python Type hints um die Eingabe-/Ausgabetypen anzuzeigen. In WHILE/LOOP-Programmen wegen des Syntax-Checkers als Kommentar zu finden.
def divtwo(x): # divtwo(x: int) -> int
# ...
return # ...
def bin(n): # bin(n: int)
if(n <= 0):
print(0)
else:
# ...
# hier könnte divtwo(...) aufgerufen werden
# ...
# hier könnte print(...) aufgerufen werden
# ...
# Keine Ausgabe notwendig, Ausgabe findet über print statt
return -1

11
exercise_1/task2.py Normal file
View file

@ -0,0 +1,11 @@
def g(x):
return (x + x)
def f(x):
if (x < 0):
d = 0
if (x == 0):
d = 1
else:
d = g(f((x - 1)))
return d

23
exercise_1/task3-l.py Normal file
View file

@ -0,0 +1,23 @@
def divtwo(x):
y=0
z=0
if (x>=0):
z=x
while ((z-y)>1):
z=(z-1)
y=(y+1)
return y
def bin(x):
z=0
y=1
if (x>0):
y=divtwo(x)
z=(x-(y+y))
print(z)
x=y
else:
print(0)
return 0
print(bin(2))

25
exercise_1/task3.py Normal file
View file

@ -0,0 +1,25 @@
def divtwo(x):
if (x >= 0):
a = 0
z = 0
# Wie oft passt die 2 in x
while (a <= x):
a = (a + 2)
z = (z + 1)
z = (z - 1)
else:
z = 0
return z
def bin(n):
if (n == 0):
print(0)
if (n > 0):
a = n
# Das Verfahren zur Bestimmung der Binärdarstellung aus der Vorlesung
while (a > 0):
q = divtwo(a) # Quotient
r = (a - (q + q)) # Rest berechnen
a = q # Nächste Zeile im Verfahren
print(r)
return 0

25
exercise_1/task3.txt Normal file
View file

@ -0,0 +1,25 @@
def divtwo(x):
if (x >= 0):
a = 0
z = 0
# Wie oft passt die 2 in x
while (a <= x):
a = (a + 2)
z = (z + 1)
z = (z - 1)
else:
z = 0
return z
def bin(n):
if (n == 0):
print(0)
if (n > 0):
a = n
# Das Verfahren zur Bestimmung der Binärdarstellung aus der Vorlesung
while (a > 0):
q = divtwo(a) # Quotient
r = (a - (q + q)) # Rest berechnen
a = q # Nächste Zeile im Verfahren
print(r)
return 0

View file

@ -0,0 +1,14 @@
def f6(x):
y = 0
while (x > 0):
x = (((x - y) - y) - 1)
y = (y + 1)
return y
def f7(x,y):
z = 1
if ((x>0) and (y>0)):
z = 0
for i in range(0,x):
z = (z + f7(x,(y-1)))
return z

Binary file not shown.

View file

@ -0,0 +1,41 @@
# Gefordert: kommentiertes WHILE-Programm
# Sie können weitere Hilfsfunktionen verwenden!
# Namen:
#
#
#
########## HILFSFUNKTIONEN ##########
def binLength(n): # binLength(n: int) -> int:
# ...
return # ...
def binTestBit(n, i): # binTestBit(n: int, i: int) -> int:
# ...
return # ...
########## HAUPTFUNKTIONEN ########## (Namen und Signatur nicht ändern!)
def ListCreate(): # ListCreate() -> int:
# ...
return # Ausgabe ist Integer, KEINE LISTE
def ListGetLength(l): # ListGetLength(l: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN
def ListGetElement(l, i): # ListGetElement(l: int, i: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN
def ListAppendElement(l, e): # ListAppendElement(l: int, e: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN

View file

@ -0,0 +1,30 @@
# Gefordert: kommentiertes WHILE-Programm; maximaler Eingabewert bei einer Minute Laufzeit (als Kommentar); Abschätzung Anzahl Rechenschritte (als Kommentar);
# Sie können weitere Hilfsfunktionen verwenden!
# Namen:
#
#
#
########## HAUPTFUNKTION ########## (Namen und Signatur nicht ändern!)
def IsOddFast(n): # IsOddFast(n: int) -> int:
# ...
return # Ausgabeformat: 0 für gerade, 1 für ungerade
# Maximaler Eingabewert bei ca. einer Minute Laufzeit:
# Abschätzung Anzahl Rechenschritte (keine Sonderzeichen oder hochgestellte Zeichen verwenden):
#
#
#
#
#
#
#
#

View file

@ -0,0 +1,53 @@
# Gefordert: kommentiertes WHILE-Programm; maximales n zum Erzeugen und Auslesen von (1,...,n) in einer Minute; Abschätzung Anzahl Rechenschritte;
# Sie können weitere Hilfsfunktionen verwenden!
# Namen:
#
#
#
########## HILFSFUNKTIONEN ##########
def binLength(n): # binLength(n: int) -> int:
# ...
return # ...
def binTestBit(n, i): # binTestBit(n: int, i: int) -> int:
# ...
return # ...
########## HAUPTFUNKTIONEN ########## (Namen und Signatur nicht ändern!)
def ListCreate(): # ListCreate() -> int:
# ...
return # Ausgabe ist Integer, KEINE LISTE
def ListGetLength(l): # ListGetLength(l: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN
def ListGetElement(l, i): # ListGetElement(l: int, i: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN
def ListAppendElement(l, e): # ListAppendElement(l: int, e: int) -> int:
# ...
return # Parameter und Ausgabe sind Integer, KEINE LISTEN
# Maximales n zum Erzeugen und Auslesen der Liste (1,...,n) in ca. einer Minute:
# Abschätzung Anzahl Rechenschritte in Abhängigkeit der Listengröße (=Anzahl Eingabebits):
#
#
#
#
#
#
#
#

18
exercise_2/task1.txt Normal file
View file

@ -0,0 +1,18 @@
0 R5 <- 4
1 R6 <- R0 - R5
2 IF R6 = 0 GOTO 5 // Wenn R0 <= 4 wird der RR0 / 5 berechnet, sonst wird 0 zurückgegeben
3 R0 <- 0
4 GOTO 17
5 R5 <- 5
6 R7 <- 0
7 R8 <- 1
8 R9 <- RR0
9 R6 <- R5 - R9
10 IF R6 = 0 GOTO 13 // Wenn RR0 >= 5 wird RR0 - 5 berechnet und R7 inkrementiert, sonst wird R7 zurückgegeben
11 R0 <- R7
12 GOTO 16
13 R6 <- R9 - R5
14 RR0 <- R6
15 R7 <- R7 + R8
16 GOTO 8
17 STOP