Sei sulla pagina 1di 18

TEORI KOMPUTASI

Pertemuan 1
Bobot penilaian :
Komponen Bobot (%)
UTS 30
UAS 30
TUGAS 20
QUIS 20
Note:
- Jadual perkuliahan Sabtu, 13.45 – 15.45
- Keterlambatan maksimal 15 menit.
- Jumlah pertemuan 14x pertemuan.
- Minimal persensi 60%, kurang dari itu nilai otomatis E.
- Mencontek, nilai otomatis E.
Materi Pembelajaran
Konsep Dasar
Penganalisis Leksik (Scanner) dan bagianya.
Konsep kerja Scanner
Finite State Automata
Ekuivalensi NFA-DFA
Penganalisis Sintak (Parser) dan bagiannya.
Konsep kerja Parser
Penyederhanaan tata bahasa bebas konteks
Bentuk Normal Chomsky
Mesin Turing
Ilmu Komputer
Ahli Bahasa
(natural language)

Ahli Biologi
(neural
network)

Ahli Elektro
(Switching)
Matematikawan
(Logika)
General Review (Alphabets, Strings, and
Representations)
Alphabets?
String?
Representations?
General Review (Formal Languages and
Grammars)
Formal
Grammars?
Language?
General Review (Stack)

Stack?
Stack Ilustration

MaxsimumSize =5

Top = 0
Stack Ilustration (1)

Push “Kevin”
MaxsimumSize =5

Kevin Top = 1
Stack Ilustration (2)

Push “Sally”
MaxsimumSize =5

Sally
Top = 2
Kevin
Stack Ilustration (3)

Push “Sally”
MaxsimumSize =5

....
....
Sally
Top = 2
Kevin
Stack Ilustration (4)

Push “Jack”
MaxsimumSize =5
Jack Top = 5
David
Beatrix
Sally
Kevin
Stack Ilustration (5)

Push “Jill”
MaxsimumSize = 5
Jack Top = 5
David
Beatrix
Sally
Kevin
Stack Ilustration (6)

Stack is full
MaxsimumSize = 5
Jack Top = 5
David
Beatrix
Sally
Kevin
Stack Ilustration (7)

Pop
MaxsimumSize = 5
Jack Top = 5
David
Beatrix
Sally
Kevin
Stack Ilustration (8)

Pop
MaxsimumSize = 5
Jack
David Top = 4
Beatrix
Sally
Kevin
Stack Pseudocode

Dim ArrayStack(5) As Integer


Const MaximumSize As Integer = 5
Dim Top As Integer
Procedure Push Procedure Pop
IF Top = MaximumSize THEN IF Top = 0 THEN
OUTPUT “Stack is Full” OUTPUT “Stcak is Empty”
ELSE ELSE
Top = Top +1 Copy item = ArrayStack(To)
ArrayStack(Top) = new Item Top = Top -1
END IF END IF
END Procedure END Procedure
Conclusion
 Item are pushed onto the top of a stack.
 Items are popped off the top of the stack.
 A last in first out data structure (LIFO).
 A stack is an abstract data type (ADT).
 Call stack store addresses, parameters and register contents when
sub routines are called.
 Used by compilers to evaluate mathematical expressions which
require intermediate steps.
 Used by programmers in a variety scenarios.

Potrebbero piacerti anche