algorytmy N6I5KEIWF32UQMGESFVEOJV6QSTI62F4GEPJE2A N6I5KEIWF32UQMGESFVEOJV6QSTI62F4GEPJE2A


0x08 graphic
Bloki używane w algorytmach:

0x08 graphic
początek, koniec

blok decyzyjny

0x08 graphic
0x08 graphic
wprowadzenie lub wyprowadzenie danych

proces

0x08 graphic

0x08 graphic
Algorytm dodawania

dowolnej ilości liczb

0x08 graphic

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
N

T

0x08 graphic

pętla

repeat until

N

T

SUMA a 1 a 2 a 3 a 4 a 5

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
3 131 16 -111 7

0 SUMA = 0

1 SUMA = SUMA + a1 = a1

2 SUMA = SUMA + a2 = a1 + a2

3 SUMA = SUMA + a3 = a1 + a2 +a3

4 SUMA = SUMA + a4 = a1 + a2 +a3 + a4

5 SUMA = SUMA + a5 = a1 + a2 +a3 + a4 + a5

.

:

n SUMA = SUMA + an = a1 + a2 +a3 + a4 + a5 + an

PORZĄDKOWANIE ZBIORU LICZB

DANE: PRZYPADKOWY ZBIÓR N LICZB

a1

a2

ai

aN-1

aN

Zadanie: uporządkować w/w zbiór wg rosnących wartości elementów tzn. uzyskać zbiór o postaci:

ai1

a12

...

ai J

aiN-1

aiN

gdzie 0x01 graphic

0x08 graphic

0x08 graphic

0x08 graphic
Metoda: wielokrotne wykonywanie

częściowego porządkowania polega

na porządkowaniu kolejnych elementów

0x08 graphic
0x08 graphic
sąsiednich.

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic

T

N

N

T

N

T

Algorytm programu realizującego porządkowanie zbioru liczb.

0x08 graphic

0x08 graphic
0x08 graphic

CZY

WSKAŹNIK

UPORZĄDKOWANIA T

0x08 graphic
0x08 graphic
0x08 graphic
JEST

ZMIENIONY

0x08 graphic

N

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic

Algorytm częściowego porządkowania

0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic

Algorytm ustawienia wskaźnika uporządkowania

0x08 graphic

0x08 graphic

0x08 graphic
0x08 graphic

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x01 graphic

0x08 graphic

0x08 graphic

0x08 graphic

Rozwiązanie operacji

0x08 graphic
częściowego

porządkowania

zbiorów

0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic
0x08 graphic

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x01 graphic

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
Rozwiązanie operacji

porządkowania dwóch

sąsiednich elementów

zbioru

0x08 graphic
0x08 graphic

0x08 graphic

0x08 graphic

0x08 graphic
0x08 graphic

0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
0x08 graphic
r 0x01 graphic
0x08 graphic
0x08 graphic
y


MAPA ŚLEDZENIA ALGORYTMU

KROK OBLICZEŃ

BLOK OPERCJI

WARTOŚĆ

x

y

r 0x01 graphic
y

q

r

1

1

50

15

2

2

0

50

3

3

T

4

4

1

35

5

3

T

6

4

2

20

7

3

T

8

4

3

5

9

3

N

10

5

3

5


DEKLARACJE, INSTRUKCJE, FUNKCJE, KOMENTARZE,

TYPY DANYCH

WPROWADZANIE DANYCH I WYPROWADZANIE WYNIKÓW

STRUKTURA PROGRAMÓW

URUCHAMIANIE PROGRAMÓW

PRZYKŁAD STRUKTURY PROGRAMU W JĘZYKU PASKAL

POCZĄTEK

ILOŚĆ SKŁADNIKÓW

N > 0

WARTOŚĆ POCZĄTKOWA

SUMA = 0; K = 0

KOLEJNY SKŁADNIK

K = K + 1

SUMA = SUMA + A

K= N

WYNIK OBLICZEŃ

SUMA

KONIEC

0

3

134

150

39

46

POCZĄTEK

PORZĄTKOWANIE

ELEMENTÓW

KONIEC

POCZĄTEK

PORZĄDEK=JEST

0x01 graphic

0x01 graphic

POM = 0x01 graphic

0x01 graphic

0x01 graphic

PORZĄDEK=BRAK

USTAWIENIE WSKAŹNIKA

UPORZĄDKOWANIA ZBIORU

KONIEC

PORZĄDEK = JEST

CZĘŚCIOWE PORZĄDKOWANIE ZBIORU I EWENTUALNA

ZMIANA WSKAŹNIKA

PORZĄDEK = JEST

POCZĄTEK

POCZĄTEK 2

KONIEC

KONIEC 2

POCZĄTEK 3

PORZĄDKOWANIE

DWÓCH SĄSIEDNICH

ELEMENTÓW

I EWENTUALNA

ZMIANA WSKAŹNIKA

UPORZĄDKOWANIA

KONIEC 3

POCZĄTEK 4

POM = 0x01 graphic

0x01 graphic

0x01 graphic

PORZĄDEK=BRAK

KONIEC 4

POCZĄTEK

WPROWADZANIE

DANYCH x, y,

USTAWIENIE ZMIENNYCH

POCZĄTKOWYCH

q = q+ 1

r = r - y

WYPROWADZENIE

WYNIKÓW q, r,

KONIEC



Wyszukiwarka

Podobne podstrony:
Układy Napędowe oraz algorytmy sterowania w bioprotezach
5 Algorytmy
5 Algorytmy wyznaczania dyskretnej transformaty Fouriera (CPS)
Tętniak aorty brzusznej algorytm
Algorytmy rastrowe
Algorytmy genetyczne
Teorie algorytmow genetycznych prezentacja
Algorytmy tekstowe
Algorytmy i struktury danych Wykład 1 Reprezentacja informacji w komputerze
ALGORYTM EUKLIDESA
Algorytmy z przykladami tp 7 0
ALGORYT8

więcej podobnych podstron