Serch
Translate
Label
Cheat Codes
(3)
Cracking and Hacking
(2)
Creator
(1)
Games
(5)
HTML Dasar
(18)
Komunikasi Data [ KOMDAT ]
(4)
Music Lyric
(67)
Pc Mig33 Tools
(24)
Ramalan Cinta
(1)
Rekayasa Perangkat Lunak
(3)
Sistem Operasi
(7)
SMS Gratis
(1)
Software
(36)
Struktur Data
(11)
Study-Pemograman
(14)
Tips Blogger
(11)
Tips dan Trick
(25)
Visual Basic
(4)
Follower
Entri Populer
Jumat, 02 Desember 2011
Matriks Merupakan array 2 dimensi, setiap elemen Matriks diidentifikasi oleh nama, indeks baris dan indeks kolom.
Pendeklarasian Matriks (array 2 dimensi) :
Const
Idxawal = 1;
Idxakhir = 100;
Type
TipeInfo = …;
TabInfo = Array [ Idxawal .. Idxakhir, Idxawal .. Idxakhir] of TipeInfo;
Var
<identifikasi_variabel> : TabInfo;
Proses – proses/operasi terhadap Matriks :
1. Pengisian elemen matriks dari fil
Read N1, N2 {N1 : jumlah baris, N2 : jumlah kolom}
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
Read M [I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
2. Pengisian elemen matriks khusus dengan assignment
a. Matriks N1 x N2 yang semua elemennya 1 :
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
M [I,J] ← 1
J ← J+1
EndWhile
I ← I+1
EndWhile
b. Matriks identitas ordo N
Read N
I ← 1
While I <= N do
J ← 1
While J <= N do
If I = J then
M[I,J] ← 1
Else
M[I,J] ← 0
Endif
J ← J+1
EndWhile
I ← I+1
EndWhile
3. Penulisan elemen matriks
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
Write M[I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
4. Penjumlahan matriks
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
C[I,J] ← A[I,J] + B[I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
5. Perkalian matriks
I ← 1
While I <= N1 do {N1 = baris Matriks A}
J ← 1
While J <= N2 do {N2 = baris Matriks B}
C[I,J] ← 0
K ← 1
While K <= N do {N = kolom matriks A = baris matriks B}
C[I,J] ← C[(I,J] + A[I,K] * B[K,J]
K ← K + 1
EndWhile
J ← J+1
EndWhile
I ← I + 1
EndWhile
Sumber dari : http://www.yudasy.web.id
Pendeklarasian Matriks (array 2 dimensi) :
Const
Idxawal = 1;
Idxakhir = 100;
Type
TipeInfo = …;
TabInfo = Array [ Idxawal .. Idxakhir, Idxawal .. Idxakhir] of TipeInfo;
Var
<identifikasi_variabel> : TabInfo;
Proses – proses/operasi terhadap Matriks :
- Pengisian elemen matriks dari fil
- Pengisian elemen matriks khusus dengan assignment
- Penulisan elemen matriks
- Penjumlahan matriks
- Perkalian matriks
1. Pengisian elemen matriks dari fil
Read N1, N2 {N1 : jumlah baris, N2 : jumlah kolom}
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
Read M [I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
2. Pengisian elemen matriks khusus dengan assignment
a. Matriks N1 x N2 yang semua elemennya 1 :
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
M [I,J] ← 1
J ← J+1
EndWhile
I ← I+1
EndWhile
b. Matriks identitas ordo N
Read N
I ← 1
While I <= N do
J ← 1
While J <= N do
If I = J then
M[I,J] ← 1
Else
M[I,J] ← 0
Endif
J ← J+1
EndWhile
I ← I+1
EndWhile
3. Penulisan elemen matriks
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
Write M[I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
4. Penjumlahan matriks
I ← 1
While I <= N1 do
J ← 1
While J <= N2 do
C[I,J] ← A[I,J] + B[I,J]
J ← J+1
EndWhile
I ← I+1
EndWhile
5. Perkalian matriks
I ← 1
While I <= N1 do {N1 = baris Matriks A}
J ← 1
While J <= N2 do {N2 = baris Matriks B}
C[I,J] ← 0
K ← 1
While K <= N do {N = kolom matriks A = baris matriks B}
C[I,J] ← C[(I,J] + A[I,K] * B[K,J]
K ← K + 1
EndWhile
J ← J+1
EndWhile
I ← I + 1
EndWhile
Sumber dari : http://www.yudasy.web.id
Labels:
Struktur Data
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar