Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
ainf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Gerwinski
ainf
Commits
bb365ccf
Commit
bb365ccf
authored
9 years ago
by
Peter Gerwinski
Browse files
Options
Downloads
Patches
Plain Diff
Übungsaufgaben 7.1.2016
parent
e9b2e486
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
20160107/ainf-uebung-20160107.pdf
+0
-0
0 additions, 0 deletions
20160107/ainf-uebung-20160107.pdf
20160107/ainf-uebung-20160107.tex
+79
-12
79 additions, 12 deletions
20160107/ainf-uebung-20160107.tex
with
79 additions
and
12 deletions
20160107/ainf-uebung-20160107.pdf
+
0
−
0
View file @
bb365ccf
No preview for this file type
This diff is collapsed.
Click to expand it.
20160107/ainf-uebung-20160107.tex
+
79
−
12
View file @
bb365ccf
...
@@ -24,21 +24,13 @@
...
@@ -24,21 +24,13 @@
\usepackage
{
pgscript
}
\usepackage
{
pgscript
}
\usepackage
{
enumerate
}
\usepackage
{
enumerate
}
\usepackage
{
pdftricks
}
\usepackage
{
ifthen
}
\usepackage
{
sfmath
}
\begin{psinputs}
\usepackage
{
pgscript
}
% \definecolor{PracticallyWhite}{rgb}{0.99 0.99 0.99}
\definecolor
{
verylightgray
}{
rgb
}{
0.95 0.95 0.95
}
\end{psinputs}
\newcounter
{
exercise
}
\newcounter
{
exercise
}
\newcommand
{
\exercise
}
[1]
{
\addtocounter
{
exercise
}{
1
}
\subsection*
{
Aufgabe
\arabic
{
exercise
}
: #1
}}
\newcommand
{
\exercise
}
[1]
{
\addtocounter
{
exercise
}{
1
}
\subsection*
{
Aufgabe
\arabic
{
exercise
}
: #1
}}
\newcounter
{
points
}
\newcounter
{
points
}
\newcommand
{
\onepoint
}{
(1 Punkt)
\addtocounter
{
points
}{
1
}}
\newcommand
{
\points
}
[1]
{
\ifthenelse
{
#1=1
}{
(1 Punkt)
}{
(#1 Punkte)
}
\addtocounter
{
points
}{
#1
}}
\newcommand
{
\points
}
[1]
{
(#1 Punkte)
\addtocounter
{
points
}{
#1
}}
\begin{document}
\begin{document}
...
@@ -46,8 +38,83 @@
...
@@ -46,8 +38,83 @@
\section*
{
Angewandte Informatik
\\
Übungsaufgaben -- 7.
\
Januar 2016
}
\section*
{
Angewandte Informatik
\\
Übungsaufgaben -- 7.
\
Januar 2016
}
\subsection*
{
???
}
\exercise
{
Landau-Symbole
}
Von welcher Ordnung (Landau-Symbol) sind die folgenden Problemstellungen?
\\
Begründen Sie jeweils Ihre Antwort.
\begin{enumerate}
[
\hspace
{
0.9em
}
(a)]
\item
Iterative Berechnung einer Fakultät
(siehe Übungsaufgabe 1 vom 19.
\,
11.
\,
2015)
\\
\points
{
1
}
\item
Rekursive Berechnung einer Fakultät
\\
\points
{
1
}
\item
Türme von Hanoi (nötige Anzahl von Verschiebungen
in Abhängigkeit von der Anzahl der Scheiben)
\\
\points
{
1
}
\item
\lstinline
{
push()
}
auf einen Stack
\\
\points
{
1
}
\item
Einfügen eines Elements irgendwo in den Stack
("`mitten in den Stapel schieben"')
\\
\points
{
1
}
\item
\lstinline
{
push()
}
auf einen FIFO
\\
\points
{
1
}
\end{enumerate}
\exercise
{
Länge von Strings
}
(Diese Übungsaufgabe ist eine Ergänzung zu Aufgabe 1 der Probeklausur
vom 22.
\,
10.
\,
2015.)
Strings werden in der Programmiersprache C durch Zeiger auf
\lstinline
{
char
}
-Variable realisiert.
Beispiel:
\lstinline
{
char *hello
_
world = "Hello, world!
\n
"
}
Die Systembibliothek stellt eine Funktion
\lstinline
{
strlen()
}
zur Ermittlung der Länge von Strings
\\
zur Verfügung (
\lstinline
{
#include <string.h>
}
).
\points
{
42
}
Wir betrachten nun die folgenden Funktionen:
\begin{center}
\begin{minipage}
{
8cm
}
\begin{lstlisting}
[gobble=8]
int fun
_
1 (char *s)
{
int x = 0;
for (int i = 0; i < strlen (s); i++)
x += s[i];
return x;
}
\end{lstlisting}
\end{minipage}
%
\begin{minipage}
{
6cm
}
\vspace*
{
-1cm
}
\begin{lstlisting}
[gobble=8]
int fun
_
2 (char *s)
{
int i = 0, x = 0;
int len = strlen (s);
while (i < len)
x += s[i++];
return x;
}
\end{lstlisting}
\vspace*
{
-1cm
}
\end{minipage}
\end{center}
\begin{itemize}
\item
[(g)]
Von welcher Ordnung (Landau-Symbol) sind die beiden Funktionen
\\
hinsichtlich der Anzahl ihrer Zugriffe auf die Zeichen im String -- und warum?
\points
{
2
}
\item
[(h)]
Von welcher Ordnung (Landau-Symbol) ist Ihre selbstgeschriebene,
effizientere Funktion und warum?
\points
{
1
}
\end{itemize}
\end{document}
\end{document}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment