Skip to content
Snippets Groups Projects
Commit 40a9948e authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vorbereitung 21.11.2016

parent 719c81e0
No related branches found
No related tags found
No related merge requests found
Showing
with 3494 additions and 2533 deletions
#include <avr/io.h>
int main (void)
{
DDRC = 0x70; /* binär: 0111 0000 */
PORTC = 0x40; /* binär: 0100 0000 */
while (1);
return 0;
}
#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
int main (void)
{
DDRC = 0x70; /* binär: 0111 0000 */
PORTC = 0x60; /* binär: 0110 0000 */
while (1)
{
_delay_ms (500);
PORTC &= ~0x40;
_delay_ms (500);
PORTC |= 0x40;
}
return 0;
}
#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
int main (void)
{
DDRC = 0x70; /* binär: 0111 0000 */
PORTC = 0x60; /* binär: 0110 0000 */
while (1)
{
_delay_ms (500);
PORTC ^= 0x40;
}
return 0;
}
#include <avr/io.h>
#define F_CPU 8000000
#include <util/delay.h>
int main (void)
{
DDRC = 0xfd;
PORTC = 0;
while (1)
{
while (PINC & 0x02 == 0)
; /* just wait */
PORTB ^= 0xf0;
_delay_ms (10);
while (PINC & 0x02 != 0)
; /* just wait */
}
return 0;
}
#include <avr/io.h>
#include <avr/interrupt.h>
ISR (TIMER0_COMP_vect)
{
PORTC ^= 0x80;
}
int main (void)
{
cli ();
TCCR0 = (1 << CS01) | (1 << CS00); /* Takt durch 64 dividieren */
TIMSK = 1 << OCIE0; /* Interrupt einschalten */
sei ();
DDRC = 0xff;
PORTC = 0;
while (1);
return 0;
}
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdint.h>
ISR (TIMER0_COMP_vect)
{
static uint8_t counter = 0;
if (counter++ == 0)
PORTC ^= 0x80;
}
int main (void)
{
cli ();
TCCR0 = (1 << CS01) | (1 << CS00); /* Takt durch 64 dividieren */
TIMSK = 1 << OCIE0; /* Interrupt einschalten */
sei ();
DDRC = 0xff;
PORTC = 0;
while (1);
return 0;
}
No preview for this file type
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
\maketitleframe \maketitleframe
\title{Hardwarenahe Programmierung}
\nosectionnonumber{\inserttitle} \nosectionnonumber{\inserttitle}
\begin{frame} \begin{frame}
...@@ -169,7 +167,7 @@ ...@@ -169,7 +167,7 @@
\fi \fi
\subsection{Aufwandsabschätzungen} \subsection{Aufwandsabschätzungen \protect\color{gray}-- Komplexitätsanalyse}
\begin{frame}[fragile] \begin{frame}[fragile]
\showsubsection \showsubsection
...@@ -184,11 +182,15 @@ ...@@ -184,11 +182,15 @@
$x$ Schleifen \textarrow\ $\mathcal{O}(n\w^x)$ $x$ Schleifen \textarrow\ $\mathcal{O}(n\w^x)$
\end{onlyenv} \end{onlyenv}
\begin{onlyenv}<8-> \begin{onlyenv}<8->
\medskip\par \begin{tabbing}
RSA: Schlüsselerzeugung $\approx\mathcal{O}(n^2)$,\\ Verschlüsselung brechen (Primfaktorzerlegung):~\=\kill
Ver- und Entschlüsselung (Exponentiation) $\approx\mathcal{O}(n\log n)$,\\ \textbf{RSA}: Schlüsselerzeugung (Berechnung von $d\/$):
Verschlüsselung brechen (Primfaktorzerlegung) \> $\mathcal{O}\bigl((\log n)^2\bigr)$,\\[\smallskipamount]
$\approx\mathcal{O}(2^{\sqrt{\log n\,\cdot\,\log\log n}})$ Ver- und Entschlüsselung (Exponentiation):
\> $\mathcal{O}\kern0.5pt(n\log n)$,\\[0.5\smallskipamount]
Verschlüsselung brechen (Primfaktorzerlegung):
\> $\mathcal{O}\bigl(2^{\sqrt{\log n\,\cdot\,\log\log n}}\bigr)$
\end{tabbing}
\end{onlyenv} \end{onlyenv}
\end{minipage}} \end{minipage}}
\end{picture}% \end{picture}%
...@@ -198,11 +200,11 @@ ...@@ -198,11 +200,11 @@
\item \item
Minimum suchen\only<3->{: $\mathcal{O}(n)$} Minimum suchen\only<3->{: $\mathcal{O}(n)$}
\hfill \hfill
\visible<3->{\begin{minipage}[t]{5.6cm} \visible<3->{\begin{minipage}[t]{5.3cm}
\only<3-7>{\vspace*{-1.3cm}\includegraphics{landau-symbols.pdf}} \only<3-7>{\vspace*{-1.0cm}\includegraphics{landau-symbols.pdf}}
\only<8->{\vspace*{-1.618cm}\includegraphics{landau-symbols-2.pdf}} \only<8->{\vspace*{-1.0cm}\includegraphics{landau-symbols-2.pdf}}
\small \small
\begin{description}\itemsep0pt \begin{description}\itemsep0pt\leftskip-0.5cm
\item[$n$:] Eingabedaten \item[$n$:] Eingabedaten
\item[$g(n)$:] Rechenzeit \item[$g(n)$:] Rechenzeit
\end{description} \end{description}
...@@ -262,26 +264,26 @@ ...@@ -262,26 +264,26 @@
\begin{frame}[fragile] \begin{frame}[fragile]
\showsection \showsection
\pause
\vspace*{-\smallskipamount} \vspace*{-\smallskipamount}
\showsubsection \showsubsection
\pause
\vspace*{-\medskipamount} \vspace*{-\medskipamount}
\showsubsubsection \showsubsubsection
\pause
\begin{onlyenv}<4> \begin{tabular}{rlrl}
\begin{tabular}{rlr} Basis & Name & Beispiel & Anwendung \\[\smallskipamount]
Basis & & Beispiel \\[\smallskipamount] 2 & Binärsystem & 1\,0000\,0011 & Bit-Operationen \\
2 & Binärsystem & 1\,0000\,0011 \\ 8 & Oktalsystem & \lstinline,0403, & Dateizugriffsrechte (Unix) \\
8 & Oktalsystem & \lstinline,0403, \\ 10 & Dezimalsystem & \lstinline,259, & Alltag \\
10 & Dezimalsystem & \lstinline,259,\\ 16 & Hexadezimalsystem & \lstinline,0x103, & Bit-Operationen \\
16 & Hexadezimalsystem & \lstinline,0x103, \\ 256 & (keiner gebräuchlich) & 0.0.1.3 & IP-Adressen (IPv4)
256 & IP-Adressen (IPv4) & 0.0.1.3
\end{tabular} \end{tabular}
\end{onlyenv}
\begin{onlyenv}<5> \end{frame}
\begin{frame}[fragile]
\showsubsubsection
Oktal- und Hexadezimal-Zahlen lassen sich ziffernweise\\ Oktal- und Hexadezimal-Zahlen lassen sich ziffernweise\\
in Binär-Zahlen umrechnen: in Binär-Zahlen umrechnen:
...@@ -297,8 +299,6 @@ ...@@ -297,8 +299,6 @@
111 7 0111 7 1111 F 111 7 0111 7 1111 F
\end{verbatim} \end{verbatim}
\end{onlyenv}
\end{frame} \end{frame}
\subsubsection{Bit-Operationen in C} \subsubsection{Bit-Operationen in C}
...@@ -319,6 +319,64 @@ ...@@ -319,6 +319,64 @@
\bigskip \bigskip
Numerierung der Bits: von rechts ab 0
\medskip
\begin{tabular}{ll}
Bit Nr.\ 3 auf 1 setzen: &
\lstinline,a |= 1 << 3;, \\
Bit Nr.\ 4 auf 0 setzen: &
\lstinline,a &= ~(1 << 4);, \\
Bit Nr.\ 0 invertieren: &
\lstinline,a ^= 1 << 0;,
\end{tabular}
\smallskip
~~Abfrage, ob Bit Nr.\ 1 gesetzt ist:\quad
\lstinline{if (a & (1 << 1))}
\end{frame}
\begin{frame}[fragile]
\showsubsubsection
C-Datentypen für Bit-Operationen:
\smallskip\par
\lstinline{#include <stdint.h>}
\medskip\par
\begin{tabular}{lllll}
& 8 Bit & 16 Bit & 32 Bit & 64 Bit \\
mit Vorzeichen & \lstinline,int8_t,
& \lstinline,int16_t,
& \lstinline,int32_t,
& \lstinline,int64_t, \\
ohne Vorzeichen & \lstinline,uint8_t,
& \lstinline,uint16_t,
& \lstinline,uint32_t,
& \lstinline,uint64_t,
\end{tabular}
\bigskip
\bigskip
Ausgabe:
\smallskip\par
\begin{lstlisting}
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
...
uint64_t x = 42;
printf ("Die Antwort lautet: %" PRIu64 "\n", x);
\end{lstlisting}
\iffalse
\bigskip
Aufgabe: Schreiben Sie C-Funktionen, die ein "`Array von Bits"' realisieren, z.\,B. Aufgabe: Schreiben Sie C-Funktionen, die ein "`Array von Bits"' realisieren, z.\,B.
\smallskip \smallskip
...@@ -340,6 +398,9 @@ ...@@ -340,6 +398,9 @@
\item \item
Sie benötigen eine Division (\lstinline|/|) sowie den Divisionsrest (Modulo: \lstinline|%|). Sie benötigen eine Division (\lstinline|/|) sowie den Divisionsrest (Modulo: \lstinline|%|).
\end{itemize} \end{itemize}
\fi
\end{frame} \end{frame}
\subsection{I/O-Ports} \subsection{I/O-Ports}
...@@ -367,42 +428,64 @@ ...@@ -367,42 +428,64 @@
\showsubsection \showsubsection
In Output-Port schreiben = Leitungen ansteuern In Output-Port schreiben = Aktoren ansteuern
Beispiel: LED
\medskip \medskip
Datei: \file{RP6Base/RP6Base\_Examples/RP6Examples\_20080915/\\ \begin{lstlisting}
RP6Lib/RP6base/RP6RobotBaseLib.c} #include <avr/io.h>
...
DDRC = 0x70;
PORTC = 0x40;
\end{lstlisting}
\bigskip
\emph{Details: siehe Datenblatt und Schaltplan}
\vspace*{-1.5cm}\hfill
{\color{red}Herstellerspezifisch!}%
\hspace*{1cm}
\vspace*{-0.61cm}%
{\color{red}%
\hspace*{3cm}binär: 0111\,0000\\
\hspace*{3cm}binär: 0100\,0000}
\end{frame}
\begin{frame}[fragile]
Suchbegriff: \lstinline{setMotorDir} \showsubsection
Aus Input-Port lesen = Sensoren abfragen
Beispiel: Taster
\medskip \medskip
\begin{lstlisting} \begin{lstlisting}
void setMotorDir(uint8_t left_dir, uint8_t right_dir) #include <avr/io.h>
{ ...
/* ... */ DDRC = 0xfd;
if(left_dir) while (PINC & 0x02 == 0)
PORTC |= DIR_L; ; /* just wait */
else
PORTC &= ~DIR_L;
if(right_dir)
PORTC |= DIR_R;
else
PORTC &= ~DIR_R;
}
\end{lstlisting} \end{lstlisting}
\begin{picture}(0,0)
\color{red}
\put(2.2,0.50){\vector(-2,1){0.5}}
\put(2.25,0.40){\makebox(0,0)[l]{Output-Port}}
\put(4.7,3.0){\vector(-2,1){0.75}}
\put(4.7,3.0){\vector(-2,-1){0.75}}
\put(4.8,3.0){\makebox(0,0)[l]{Manipulation einzelner Bits}}
\end{picture}
\vspace*{-1.5cm} \bigskip
\strut\hfill\textarrow\ Steuerung der Motordrehrichtung
\emph{Details: siehe Datenblatt und Schaltplan}
\vspace*{-1.5cm}\hfill
{\color{red}Herstellerspezifisch!}%
\hspace*{1cm}
\vspace*{-1.03cm}%
{\color{red}%
\hspace*{4.3cm}binär: 1111\,1101\\
\hspace*{4.3cm}binär: 0000\,0010}
\end{frame} \end{frame}
...@@ -416,35 +499,79 @@ ...@@ -416,35 +499,79 @@
Zeiger hinterlegen: "`Interrupt-Vektor"' Zeiger hinterlegen: "`Interrupt-Vektor"'
Beispiel: Taster
\medskip \medskip
Datei: \file{RP6Base/RP6Base\_Examples/RP6Examples\_20080915/\\ \begin{lstlisting}
RP6Lib/RP6base/RP6RobotBaseLib.c} #include <avr/interrupt.h>
Suchbegriff: \lstinline{ISR} ...
\vspace{2.0cm}
\begin{lstlisting}
ISR (INT0_vect) ISR (INT0_vect)
{ {
mleft_dist++; PORTC ^= 0x80;
mleft_counter++;
/* ... */
} }
\end{lstlisting} \end{lstlisting}
\begin{picture}(0,0) \begin{picture}(0,0)
\color{red} \color{red}
\put(1.9,4.3){\vector(-1,-1){1.4}} \put(1.9,3.1){\makebox(0,0)[tr]{\tikz{\draw[-latex](0,0)--(-1.4,-1.0);}}}
\put(2.0,4.4){\makebox(0,0)[l]{"`Dies ist ein Interrupt-Handler."'}} \put(2.0,3.2){\makebox(0,0)[l]{"`Dies ist ein Interrupt-Handler."'}}
\put(2.3,3.6){\vector(-1,-1){0.7}} \put(2.3,2.6){\makebox(0,0)[tr]{\tikz{\draw[-latex](0,0)--(-0.6,-0.55);}}}
\put(2.4,3.6){\makebox(0,0)[l]{Interrupt-Vektor 0 darauf zeigen lassen}} \put(2.4,2.6){\makebox(0,0)[l]{Interrupt-Vektor 0 darauf zeigen lassen}}
\put(3.7,2.9){\makebox(0,0)[l]{Schreibweise herstellerspezifisch!}}
\end{picture} \end{picture}
\vspace*{-1.5cm} \bigskip
\strut\hfill Aufruf durch Sensor an Encoder-Scheibe\\
\strut\hfill\textarrow\ Entfernungsmessung \emph{Details: siehe Datenblatt und Schaltplan}
\vspace*{-2.5cm}\hfill
{\color{red}Herstellerspezifisch!}%
\hspace*{1cm}
\end{frame}
\begin{frame}[fragile]
\showsubsection
Externes Gerät ruft (per Stromsignal) Unterprogramm auf
Zeiger hinterlegen: "`Interrupt-Vektor"'
Beispiel: eingebaute Uhr
\medskip
\begin{lstlisting}
#include <avr/interrupt.h>
...
ISR (TIMER0_COMP_vect)
{
PORTC ^= 0x01;
}
\end{lstlisting}
\medskip
Initialisierung über spezielle Ports:
\lstinline{TCCR0}, \lstinline{TIMSK}
\bigskip
\emph{Details: siehe Datenblatt und Schaltplan}
\vspace*{-2.5cm}\hfill
{\color{red}Herstellerspezifisch!}%
\hspace*{1cm}
\pause
\vspace*{2.5cm}
\bigskip
Praktikumsaufgabe: Druckknopfampel
\end{frame} \end{frame}
......
File added
% hp-uebung-20161121.pdf - Exercises on Low-Level Programming / Applied Computer Sciences
% Copyright (C) 2013, 2015, 2016 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
\documentclass[a4paper]{article}
\usepackage{pgscript}
\usepackage{enumerate}
\newcounter{exercise}
\newcommand{\exercise}[1]{\addtocounter{exercise}{1}\subsection*{Aufgabe \arabic{exercise}: #1}}
\newcounter{points}
\newcommand{\onepoint}{(1 Punkt)\addtocounter{points}{1}}
\newcommand{\points}[1]{(#1 Punkte)\addtocounter{points}{#1}}
\begin{document}
% \thispagestyle{empty}
\section*{Hardwarenahe Programmierung / Angewandte Informatik\\
Übungsaufgaben -- 21.\ November 2016}
\exercise{Zahlensysteme}
Wandeln Sie ohne Hilfsmittel
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Dezimal:
\begin{itemize}
\item[(a)]
0010\,0000$_2$
\item[(b)]
42$_{16}$
\item[(c)]
17$_8$
\end{itemize}
\end{itemize}
\end{minipage}\hfill
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Hexadezimal:
\begin{itemize}
\item[(d)]
0010\,0000$_2$
\item[(e)]
42$_{10}$
\item[(f)]
192.168.20.254$_{256}$
\end{itemize}
\end{itemize}
\end{minipage}\hfill
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Binär:
\begin{itemize}
\item[(g)]
750$_8$
\item[(h)]
42$_{10}$
\item[(i)]
AFFE$_{16}$
\end{itemize}
\end{itemize}
\end{minipage}
\medskip
Berechnen Sie ohne Hilfsmittel:
\begin{itemize}
\item[(j)]
750$_8$ \& 666$_8$
\item[(k)]
A380$_{16}$ + B747$_{16}$
\item[(l)]
AFFE$_{16} >> 1$
\end{itemize}
(Die tiefgestellte Zahl steht für die Basis des Zahlensystems.)
\exercise{Mikro-Controller}
\begin{minipage}[t]{10cm}
An die vier Ports eines ATmega16-Mikro-Controllers sind Leuchtdioden angeschlossen:
\begin{itemize}
\item
von links nach rechts an die Ports A, B, C und D,
\item
von oben nach unten an die Bits Nr.\ 0 bis 7.
\end{itemize}
Wir betrachten das folgende Programm:
\begin{lstlisting}[gobble=6]
#include <avr/io.h>
int main (void)
{
DDRA = DDRB = DDRC = DDRD = 0xff;
PORTA = 0x1f;
PORTB = PORTD = 0x10;
PORTC = 0xfc;
while (1);
return 0;
}
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}[t]{3cm}
\strut\\[-\baselineskip]
\includegraphics[width=3cm]{leds.jpg}
\end{minipage}
\begin{itemize}
\item[(a)]
Was bewirkt dieses Programm? % (4 Punkte)
\item[(b)]
Wozu dient die erste Zeile des Hauptprogramms? % (2 Punkte)
\item[(c)]
Was würde stattdessen die Zeile \lstinline{DDRA, DDRB, DDRC, DDRD = 0xff;} bewirken? % (2 Punkte)
\item[(c)]
Schreiben Sie das Programm so um, daß die dargestellte Figur spiegelverkehrt erscheint. % (3 Punkte)
\item[(d)]
Wozu dient das \lstinline{while (1)}? % (2 Punkte)
\end{itemize}
\exercise{Arrays mit Zahlen}
\begin{minipage}[t]{0.5\textwidth}
Wir betrachten das folgende Programm:
\begin{lstlisting}[gobble=6]
#include <stdio.h>
void f (int *s0, int *s1)
{
while (*s0 >= 0)
{
int *s = s1;
while (*s >= 0)
if (*s0 == *s++)
printf ("%d ", *s0);
s0++;
}
printf ("\n");
}
int main (void)
{
int a[] = { 10, 4, 3, 7, 12, 0, 1, -1 };
int b[] = { 7, 14, 0, 8, 9, 22, 10, -1 };
f (a, b);
return 0;
}
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}[t]{0.5\textwidth}
\vspace*{-\bigskipamount}
\begin{enumerate}[\quad(a)]
\item
Was bewirkt die Funktion \lstinline{f} und warum?
% \points{4}
\item
Von welcher Ordnung (Landau-Symbol) ist die Funktion und warum?
Wir beziehen uns hierbei auf die Anzahl der Vergleiche
in Abhängigkeit von der Länge der Eingabedaten \lstinline{s0} und \lstinline{s1}.
Für die Rechnung dürfen Sie beide Längen mit $n$ gleichsetzen,
obwohl sie normalerweise nicht gleich sind.
% \points{2}
\item
Was passiert, wenn Sie beim Aufruf der Funktion für einen der
Parameter den Wert \lstinline{NULL} übergeben und warum?
% \points{2}
\item
Was passiert, wenn Sie das Hauptprogramm wie folgt abändern
(\file{aufgabe-1d.c}) und warum?
\begin{lstlisting}[gobble=8]
int main (void)
{
int a[] = { 10, 4, 3, 7, 12, 0, 1 };
int b[] = { 7, 14, 0, 8, 9, 22, 10 };
f (a, b);
return 0;
}
\end{lstlisting}
% \points{2}
\item
Beschreiben Sie -- in Worten und/oder als C-Quelltext --, wie
sich die Funktion \lstinline{f} effizienter gestalten läßt,
wenn man die ihr übergebenen Arrays \lstinline{s0} und
\lstinline{s1} als sortiert voraussetzt.
% \points{5}
Hinweis: Wie würden Sie als Mensch die Aufgabe erledigen?
\item
Von welcher
Ordnung (Landau-Symbol) ist Ihre effizientere Version der Funktion und warum?
% \points{2}
\end{enumerate}
\end{minipage}
\end{document}
../common/leds.jpg
\ No newline at end of file
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
int main (void)
{
uint64_t x = 42;
printf ("Die Antwort lautet: %" PRIu64 "\n", x);
return 0;
}
This diff is collapsed.
No preview for this file type
...@@ -14,22 +14,27 @@ ...@@ -14,22 +14,27 @@
\psline[arrows=->](-10,0)(200,0) \psline[arrows=->](-10,0)(200,0)
\psline[arrows=->](0,-10)(0,200) \psline[arrows=->](0,-10)(0,200)
\psplot[plotpoints=200]{1}{125}{2 x 0.06 mul exp} \psplot[plotpoints=200]{1}{125}{2 x 0.06 mul exp}
\put(70,190){\mbox{$g(n) \sim 2^n$}} \put(120,190){\mbox{$2^n$}}
\psplot[plotpoints=200,linecolor=red]{1}{175}{0.6 2 x ln x ln 0.0000001 add ln mul exp mul} \psplot[linecolor=red,plotpoints=200]{1}{175}{0.6 2 x ln x ln 0.0000001 add ln mul exp mul}
\color{red} \color{red}
\put(75,220){\mbox{$g(n) \sim 2^{\sqrt{\log n\,\cdot\,\log\log n}}$}} \put(110,215){\mbox{$2^{\sqrt{\log n\,\cdot\,\log\log n}}$}}
\color{black} \color{black}
\psplot[plotpoints=200]{0}{190}{x x mul 0.005 mul} \psplot[plotpoints=200]{0}{190}{x x mul 0.005 mul}
\put(190,190){\mbox{$g(n) \sim n^2$}} \put(190,190){\mbox{$n^2$}}
\psplot[plotpoints=200]{1}{190}{x ln x mul 0.1 mul} \color{red}
\put(195,100){\mbox{$g(n) \sim n \log n$}} \psplot[linecolor=red,plotpoints=200]{1}{190}{x ln x mul 0.1 mul}
\put(195,100){\mbox{$n \log n$}}
\psplot[linecolor=red,plotpoints=200]{1}{190}{x ln x ln mul 2.3 mul}
\put(195,57.5){\mbox{$(\log n)^2$}}
\color{black}
\psplot[plotpoints=200]{0}{190}{x 0.4 mul} \psplot[plotpoints=200]{0}{190}{x 0.4 mul}
\put(195,75){\mbox{$g(n) \sim n$}} \put(195,75){\mbox{$n$}}
\psplot[plotpoints=200]{1}{190}{x ln 10 mul} \psplot[plotpoints=200]{1}{190}{x ln 10 mul}
\put(195,50){\mbox{$g(n) \sim \log n$}} \put(195,40){\mbox{$\log n$}}
\psplot[plotpoints=200]{1}{190}{30} \psplot[plotpoints=200]{1}{190}{30}
\put(195,25){\mbox{$g(n) \sim 1$}} \put(195,25){\mbox{$1$}}
\put(205,0){\makebox(0,0)[l]{$n$}} \put(205,0){\makebox(0,0)[l]{$n$}}
\put(-10,210){\makebox(0,0)[l]{$g(n)$}} % \put(-10,210){\makebox(0,0)[l]{$g(n)$}}
\put(-10,210){\makebox(0,0)[l]{$\mathcal{O}\bigl(g(n)\bigl)$}}
\end{pspicture} \end{pspicture}
\end{document} \end{document}
This diff is collapsed.
No preview for this file type
...@@ -14,18 +14,19 @@ ...@@ -14,18 +14,19 @@
\psline[arrows=->](-10,0)(200,0) \psline[arrows=->](-10,0)(200,0)
\psline[arrows=->](0,-10)(0,200) \psline[arrows=->](0,-10)(0,200)
\psplot[plotpoints=200]{1}{125}{2 x 0.06 mul exp} \psplot[plotpoints=200]{1}{125}{2 x 0.06 mul exp}
\put(70,190){\mbox{$g(n) \sim 2^n$}} \put(120,190){\mbox{$2^n$}}
\psplot[plotpoints=200]{0}{190}{x x mul 0.005 mul} \psplot[plotpoints=200]{0}{190}{x x mul 0.005 mul}
\put(190,190){\mbox{$g(n) \sim n^2$}} \put(190,190){\mbox{$n^2$}}
\psplot[plotpoints=200]{1}{190}{x ln x mul 0.1 mul} \psplot[plotpoints=200]{1}{190}{x ln x mul 0.1 mul}
\put(195,100){\mbox{$g(n) \sim n \log n$}} \put(195,100){\mbox{$n \log n$}}
\psplot[plotpoints=200]{0}{190}{x 0.4 mul} \psplot[plotpoints=200]{0}{190}{x 0.4 mul}
\put(195,75){\mbox{$g(n) \sim n$}} \put(195,75){\mbox{$n$}}
\psplot[plotpoints=200]{1}{190}{x ln 10 mul} \psplot[plotpoints=200]{1}{190}{x ln 10 mul}
\put(195,50){\mbox{$g(n) \sim \log n$}} \put(195,50){\mbox{$\log n$}}
\put(205,0){\makebox(0,0)[l]{$n$}} \put(205,0){\makebox(0,0)[l]{$n$}}
\put(-10,210){\makebox(0,0)[l]{$g(n)$}} % \put(-10,210){\makebox(0,0)[l]{$g(n)$}}
\put(-10,210){\makebox(0,0)[l]{$\mathcal{O}\bigl(g(n)\bigl)$}}
\psplot[plotpoints=200]{1}{190}{30} \psplot[plotpoints=200]{1}{190}{30}
\put(195,25){\mbox{$g(n) \sim 1$}} \put(195,25){\mbox{$1$}}
\end{pspicture} \end{pspicture}
\end{document} \end{document}
common/leds.jpg

43.8 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment